You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
716 B

import dateFunc, { type ConfigType } from 'dayjs';
const DATE_TIME_TEMPLATE = 'YYYY-MM-DD HH:mm:ss';
const DATE_TEMPLATE = 'YYYY-MM-DD';
/**
* @zh_CN
* @param date
* @param format
* @returns YYYY-MM-DD HH:mm:ss
*/
function formatDate(date?: ConfigType, format = DATE_TEMPLATE): string {
return dateFunc(date).format(format);
}
/**
* @zh_CN
* @param date
* @returns
*/
function formatDateTime(date?: ConfigType): string {
return formatDate(date, DATE_TIME_TEMPLATE);
}
export { formatDate, formatDateTime };