mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
15 lines
288 B
TypeScript
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);
|
|
}
|