react-dates-rtl
Version:
Based on react-dates by airbnb [with RTL support]
13 lines (8 loc) • 343 B
JavaScript
import moment from 'moment';
import toMomentObject from './toMomentObject';
import { ISO_FORMAT } from '../../constants';
export default function toISODateString(date, currentFormat) {
const dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat);
if (!dateObj) return null;
return dateObj.format(ISO_FORMAT);
}