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