ant-design/components/date-picker/utils.ts
2019-03-06 13:45:40 +08:00

15 lines
288 B
TypeScript

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);
}