1 | import moment from 'moment';
|
2 |
|
3 | import toMomentObject from './toMomentObject';
|
4 |
|
5 | import { DISPLAY_FORMAT } from '../constants';
|
6 |
|
7 | export default function toLocalizedDateString(date, currentFormat) {
|
8 | const dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat);
|
9 | if (!dateObj) return null;
|
10 |
|
11 | return dateObj.format(DISPLAY_FORMAT);
|
12 | }
|