生产监控前端
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.
 
 
 
 
 
 

12 lines
369 B

import { format } from 'date-fns';
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm';
const DATE_FORMAT = 'YYYY-MM-DD ';
export function formatToDateTime(date: Date | number, formatStr = DATE_TIME_FORMAT): string {
return format(date, formatStr);
}
export function formatToDate(date: Date | number, formatStr = DATE_FORMAT): string {
return format(date, formatStr);
}