|
|
|
@ -70,7 +70,7 @@ export function formatDate(date: Date, format?: string): string {
|
|
|
|
|
return '' |
|
|
|
|
} |
|
|
|
|
// 日期存在,则进行格式化
|
|
|
|
|
return date ? dayjs(date).locale('zh-cn').format(format ?? 'YYYY-MM-DD HH:mm:ss') : '' |
|
|
|
|
return date ? dayjs(date).locale('zh-cn').format(format ?? 'YYYY年M月D日 H时m分s秒') : '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -111,7 +111,7 @@ export function getWeek(dateTime: Date): number {
|
|
|
|
|
* @description param 3天: 60 * 60* 24 * 1000 * 3 |
|
|
|
|
* @returns 返回拼接后的时间字符串 |
|
|
|
|
*/ |
|
|
|
|
export function formatPast(param: string | Date, format = 'YYYY-MM-DD HH:mm:ss'): string { |
|
|
|
|
export function formatPast(param: string | Date, format = 'YYYY年M月D日 H时m分s秒'): string { |
|
|
|
|
// 传入格式处理、存储转换值
|
|
|
|
|
let t: any, s: number |
|
|
|
|
// 获取js 时间戳
|
|
|
|
@ -199,7 +199,7 @@ export function formatPast2(ms: number): string {
|
|
|
|
|
* @param cellValue 字段值 |
|
|
|
|
*/ |
|
|
|
|
export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { |
|
|
|
|
return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日 AHH时mm分') : '' |
|
|
|
|
return cellValue ? formatDate(cellValue, 'YYYY年M月D日 AH时m分') : '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -210,7 +210,7 @@ export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue
|
|
|
|
|
* @param cellValue 字段值 |
|
|
|
|
*/ |
|
|
|
|
export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { |
|
|
|
|
return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日') : '' |
|
|
|
|
return cellValue ? formatDate(cellValue, 'YYYY年M月D日') : '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -221,7 +221,7 @@ export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValu
|
|
|
|
|
* @param cellValue 字段值 |
|
|
|
|
*/ |
|
|
|
|
export function dateFormatter3(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { |
|
|
|
|
return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日') : '' |
|
|
|
|
return cellValue ? formatDate(cellValue, 'YYYY年M月D日') : '' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -338,7 +338,7 @@ export function getDateRange(
|
|
|
|
|
endDate: dayjs.ConfigType |
|
|
|
|
): [string, string] { |
|
|
|
|
return [ |
|
|
|
|
dayjs(beginDate).startOf('d').format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
|
dayjs(endDate).endOf('d').format('YYYY-MM-DD HH:mm:ss') |
|
|
|
|
dayjs(beginDate).startOf('d').format('YYYY年M月D日 H时m分s秒'), |
|
|
|
|
dayjs(endDate).endOf('d').format('YYYY年M月D日 H时m分s秒') |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|