del: 格式时间-到指定时区

This commit is contained in:
TsMask
2024-04-01 18:15:50 +08:00
parent 4de98923b7
commit f4ed68fc44
2 changed files with 2 additions and 23 deletions

View File

@@ -1,8 +1,5 @@
// 依赖来源 https://github.com/iamkun/dayjs
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc'; // 导入 UTC 插件
// 应用 UTC 插件
dayjs.extend(utc);
// 导入本地化语言并设为默认使用,只需要全局有引入就行
// import('dayjs/locale/zh-cn');
@@ -76,21 +73,6 @@ export function diffValue(
return value;
}
/**
* 格式时间-到指定时区
* @param date 可转的Date对象
* @param utcOffset 分钟偏移量
* @param formatStr 时间格式 默认YYYY-MM-DD HH:mm:ss
* @returns 时间格式字符串
*/
export function parseDateToStrByUTCOffset(
date: string | number | Date,
utcOffset: number,
formatStr: string = YYYY_MM_DD_HH_MM_SS
): string {
return dayjs(date).utcOffset(utcOffset).format(formatStr);
}
/**
* 格式化秒值为 ?h?m?s
* @param seconds 2558 秒