ant-design/components/date-picker/utils.ts

15 lines
274 B
TypeScript
Raw Normal View History

2019-05-07 14:57:32 +08:00
import * as moment from 'moment';
export function formatDate(
value: moment.Moment | undefined | null,
format: string | string[],
): string {
if (!value) {
return '';
}
if (Array.isArray(format)) {
format = format[0];
}
return value.format(format);
}