MCPcopy Index your code
hub / github.com/react-dates/react-dates / toMomentObject

Function toMomentObject

src/utils/toMomentObject.js:5–12  ·  view source on GitHub ↗
(dateString, customFormat)

Source from the content-addressed store, hash-verified

3import { DISPLAY_FORMAT, ISO_FORMAT } from '../constants';
4
5export default function toMomentObject(dateString, customFormat) {
6 const dateFormats = customFormat
7 ? [customFormat, DISPLAY_FORMAT, ISO_FORMAT]
8 : [DISPLAY_FORMAT, ISO_FORMAT];
9
10 const date = moment(dateString, dateFormats, true);
11 return date.isValid() ? date.hour(12) : null;
12}

Callers 7

onChangeMethod · 0.85
onEndDateChangeMethod · 0.85
onStartDateChangeMethod · 0.85
toISOMonthStringFunction · 0.85
toISODateStringFunction · 0.85
toLocalizedDateStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…