mirror of
https://github.com/ant-design/ant-design.git
synced 2025-07-01 09:31:14 +08:00
12 lines
294 B
TypeScript
12 lines
294 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);
|
|
}
|