MCPcopy
hub / github.com/react-dates/react-dates / toISOMonthString

Function toISOMonthString

src/utils/toISOMonthString.js:5–14  ·  view source on GitHub ↗
(date, currentFormat)

Source from the content-addressed store, hash-verified

3import toMomentObject from './toMomentObject';
4
5export default function toISOMonthString(date, currentFormat) {
6 const dateObj = moment.isMoment(date) ? date : toMomentObject(date, currentFormat);
7 if (!dateObj) return null;
8
9 // Template strings compiled in strict mode uses concat, which is slow. Since
10 // this code is in a hot path and we want it to be as fast as possible, we
11 // want to use old-fashioned +.
12 // eslint-disable-next-line prefer-template
13 return dateObj.year() + '-' + String(dateObj.month() + 1).padStart(2, '0');
14}

Callers 8

renderMethod · 0.85
getVisibleDaysFunction · 0.85
addModifierFunction · 0.85
deleteModifierFunction · 0.85
isDayVisibleFunction · 0.85

Calls 1

toMomentObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…