ant-design/components/date-picker/utils.ts
2019-08-14 18:21:24 +08:00

16 lines
331 B
TypeScript

import * as moment from 'moment';
// eslint-disable-next-line import/prefer-default-export
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);
}