react-dates
Version:
A responsive and accessible date range picker component built with React
8 lines • 333 B
JavaScript
import moment from 'moment';
import toMomentObject from './toMomentObject';
import { ISO_FORMAT } from '../constants';
export default function toISODateString(date, currentFormat) {
var dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat);
if (!dateObj) return null;
return dateObj.format(ISO_FORMAT);
}