@mui/x-date-pickers 8.10.0 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/AdapterDateFns/AdapterDateFns.js +194 -195
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.js +57 -62
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +197 -198
  4. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +196 -196
  5. package/AdapterDateFnsV2/AdapterDateFnsV2.js +193 -193
  6. package/AdapterDayjs/AdapterDayjs.js +378 -379
  7. package/AdapterLuxon/AdapterLuxon.js +324 -326
  8. package/AdapterMoment/AdapterMoment.js +297 -302
  9. package/AdapterMomentHijri/AdapterMomentHijri.js +78 -78
  10. package/AdapterMomentJalaali/AdapterMomentJalaali.js +78 -80
  11. package/CHANGELOG.md +309 -0
  12. package/PickersTextField/PickersInputBase/PickersInputBase.js +14 -1
  13. package/PickersTextField/PickersTextField.js +3 -2
  14. package/esm/AdapterDateFns/AdapterDateFns.js +194 -194
  15. package/esm/AdapterDateFnsBase/AdapterDateFnsBase.js +57 -62
  16. package/esm/AdapterDateFnsJalali/AdapterDateFnsJalali.js +197 -197
  17. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +196 -196
  18. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +193 -193
  19. package/esm/AdapterDayjs/AdapterDayjs.js +378 -379
  20. package/esm/AdapterLuxon/AdapterLuxon.js +324 -325
  21. package/esm/AdapterMoment/AdapterMoment.js +297 -301
  22. package/esm/AdapterMomentHijri/AdapterMomentHijri.js +78 -78
  23. package/esm/AdapterMomentJalaali/AdapterMomentJalaali.js +78 -80
  24. package/esm/PickersTextField/PickersInputBase/PickersInputBase.js +14 -1
  25. package/esm/PickersTextField/PickersTextField.js +3 -2
  26. package/esm/index.js +1 -1
  27. package/esm/internals/hooks/useField/syncSelectionToDOM.js +3 -1
  28. package/esm/internals/models/helpers.d.ts +1 -1
  29. package/esm/models/fields.d.ts +4 -0
  30. package/index.js +1 -1
  31. package/internals/hooks/useField/syncSelectionToDOM.js +3 -1
  32. package/internals/models/helpers.d.ts +1 -1
  33. package/models/fields.d.ts +4 -0
  34. package/package.json +15 -16
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- /* eslint-disable class-methods-use-this */
3
2
  import defaultMoment from 'moment';
4
3
  // From https://momentjs.com/docs/#/displaying/format/
5
4
  const formatTokenMap = {
@@ -147,317 +146,314 @@ const MISSING_TIMEZONE_PLUGIN = ['Missing timezone plugin', 'To be able to use t
147
146
  * SOFTWARE.
148
147
  */
149
148
  export class AdapterMoment {
149
+ isMUIAdapter = true;
150
+ isTimezoneCompatible = true;
151
+ lib = 'moment';
152
+ escapedCharacters = {
153
+ start: '[',
154
+ end: ']'
155
+ };
156
+ formatTokenMap = (() => formatTokenMap)();
150
157
  constructor({
151
158
  locale,
152
159
  formats,
153
160
  instance
154
161
  } = {}) {
155
- this.isMUIAdapter = true;
156
- this.isTimezoneCompatible = true;
157
- this.lib = 'moment';
158
- this.moment = void 0;
159
- this.locale = void 0;
160
- this.formats = void 0;
161
- this.escapedCharacters = {
162
- start: '[',
163
- end: ']'
164
- };
165
- this.formatTokenMap = formatTokenMap;
166
- this.setLocaleToValue = value => {
167
- const expectedLocale = this.getCurrentLocaleCode();
168
- if (expectedLocale === value.locale()) {
169
- return value;
170
- }
171
- return value.locale(expectedLocale);
172
- };
173
- this.hasTimezonePlugin = () => typeof this.moment.tz !== 'undefined';
174
- this.createSystemDate = value => {
175
- const parsedValue = this.moment(value).local();
176
- if (this.locale === undefined) {
177
- return parsedValue;
178
- }
179
- return parsedValue.locale(this.locale);
180
- };
181
- this.createUTCDate = value => {
182
- const parsedValue = this.moment.utc(value);
183
- if (this.locale === undefined) {
184
- return parsedValue;
185
- }
186
- return parsedValue.locale(this.locale);
187
- };
188
- this.createTZDate = (value, timezone) => {
162
+ this.moment = instance || defaultMoment;
163
+ this.locale = locale;
164
+ this.formats = _extends({}, defaultFormats, formats);
165
+ }
166
+ setLocaleToValue = value => {
167
+ const expectedLocale = this.getCurrentLocaleCode();
168
+ if (expectedLocale === value.locale()) {
169
+ return value;
170
+ }
171
+ return value.locale(expectedLocale);
172
+ };
173
+ hasTimezonePlugin = () => typeof this.moment.tz !== 'undefined';
174
+ createSystemDate = value => {
175
+ const parsedValue = this.moment(value).local();
176
+ if (this.locale === undefined) {
177
+ return parsedValue;
178
+ }
179
+ return parsedValue.locale(this.locale);
180
+ };
181
+ createUTCDate = value => {
182
+ const parsedValue = this.moment.utc(value);
183
+ if (this.locale === undefined) {
184
+ return parsedValue;
185
+ }
186
+ return parsedValue.locale(this.locale);
187
+ };
188
+ createTZDate = (value, timezone) => {
189
+ /* v8 ignore next 3 */
190
+ if (!this.hasTimezonePlugin()) {
191
+ throw new Error(MISSING_TIMEZONE_PLUGIN);
192
+ }
193
+ const parsedValue = timezone === 'default' ? this.moment(value) : this.moment.tz(value, timezone);
194
+ if (this.locale === undefined) {
195
+ return parsedValue;
196
+ }
197
+ return parsedValue.locale(this.locale);
198
+ };
199
+ date = (value, timezone = 'default') => {
200
+ if (value === null) {
201
+ return null;
202
+ }
203
+ if (timezone === 'UTC') {
204
+ return this.createUTCDate(value);
205
+ }
206
+ if (timezone === 'system' || timezone === 'default' && !this.hasTimezonePlugin()) {
207
+ return this.createSystemDate(value);
208
+ }
209
+ return this.createTZDate(value, timezone);
210
+ };
211
+ getInvalidDate = () => this.moment(new Date('Invalid Date'));
212
+ getTimezone = value => {
213
+ // @ts-ignore
214
+ // eslint-disable-next-line no-underscore-dangle
215
+ const zone = value._z?.name;
216
+ const defaultZone = value.isUTC() ? 'UTC' : 'system';
217
+
218
+ // @ts-ignore
219
+ return zone ?? this.moment.defaultZone?.name ?? defaultZone;
220
+ };
221
+ setTimezone = (value, timezone) => {
222
+ if (this.getTimezone(value) === timezone) {
223
+ return value;
224
+ }
225
+ if (timezone === 'UTC') {
226
+ return value.clone().utc();
227
+ }
228
+ if (timezone === 'system') {
229
+ return value.clone().local();
230
+ }
231
+ if (!this.hasTimezonePlugin()) {
189
232
  /* v8 ignore next 3 */
190
- if (!this.hasTimezonePlugin()) {
233
+ if (timezone !== 'default') {
191
234
  throw new Error(MISSING_TIMEZONE_PLUGIN);
192
235
  }
193
- const parsedValue = timezone === 'default' ? this.moment(value) : this.moment.tz(value, timezone);
194
- if (this.locale === undefined) {
195
- return parsedValue;
196
- }
197
- return parsedValue.locale(this.locale);
198
- };
199
- this.date = (value, timezone = 'default') => {
200
- if (value === null) {
201
- return null;
202
- }
203
- if (timezone === 'UTC') {
204
- return this.createUTCDate(value);
205
- }
206
- if (timezone === 'system' || timezone === 'default' && !this.hasTimezonePlugin()) {
207
- return this.createSystemDate(value);
208
- }
209
- return this.createTZDate(value, timezone);
210
- };
211
- this.getInvalidDate = () => this.moment(new Date('Invalid Date'));
212
- this.getTimezone = value => {
213
- // @ts-ignore
214
- // eslint-disable-next-line no-underscore-dangle
215
- const zone = value._z?.name;
216
- const defaultZone = value.isUTC() ? 'UTC' : 'system';
217
-
218
- // @ts-ignore
219
- return zone ?? this.moment.defaultZone?.name ?? defaultZone;
220
- };
221
- this.setTimezone = (value, timezone) => {
222
- if (this.getTimezone(value) === timezone) {
223
- return value;
224
- }
225
- if (timezone === 'UTC') {
226
- return value.clone().utc();
227
- }
228
- if (timezone === 'system') {
229
- return value.clone().local();
230
- }
231
- if (!this.hasTimezonePlugin()) {
232
- /* v8 ignore next 3 */
233
- if (timezone !== 'default') {
234
- throw new Error(MISSING_TIMEZONE_PLUGIN);
235
- }
236
- return value;
237
- }
238
- const cleanZone = timezone === 'default' ?
239
- // @ts-ignore
240
- this.moment.defaultZone?.name ?? 'system' : timezone;
241
- if (cleanZone === 'system') {
242
- return value.clone().local();
243
- }
244
- const newValue = value.clone();
245
- newValue.tz(cleanZone);
246
- return newValue;
247
- };
248
- this.toJsDate = value => {
249
- return value.toDate();
250
- };
251
- this.parse = (value, format) => {
252
- if (value === '') {
253
- return null;
254
- }
255
- if (this.locale) {
256
- return this.moment(value, format, this.locale, true);
257
- }
258
- return this.moment(value, format, true);
259
- };
260
- this.getCurrentLocaleCode = () => {
261
- return this.locale || defaultMoment.locale();
262
- };
263
- this.is12HourCycleInCurrentLocale = () => {
264
- return /A|a/.test(defaultMoment.localeData(this.getCurrentLocaleCode()).longDateFormat('LT'));
265
- };
266
- this.expandFormat = format => {
267
- // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
268
- const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
269
- return format.match(localFormattingTokens).map(token => {
270
- const firstCharacter = token[0];
271
- if (firstCharacter === 'L' || firstCharacter === ';') {
272
- return defaultMoment.localeData(this.getCurrentLocaleCode()).longDateFormat(token);
273
- }
274
- return token;
275
- }).join('');
276
- };
277
- this.isValid = value => {
278
- if (value == null) {
279
- return false;
280
- }
281
- return value.isValid();
282
- };
283
- this.format = (value, formatKey) => {
284
- return this.formatByString(value, this.formats[formatKey]);
285
- };
286
- this.formatByString = (value, formatString) => {
287
- const clonedDate = value.clone();
288
- clonedDate.locale(this.getCurrentLocaleCode());
289
- return clonedDate.format(formatString);
290
- };
291
- this.formatNumber = numberToFormat => {
292
- return numberToFormat;
293
- };
294
- this.isEqual = (value, comparing) => {
295
- if (value === null && comparing === null) {
296
- return true;
297
- }
298
- if (value === null || comparing === null) {
299
- return false;
236
+ return value;
237
+ }
238
+ const cleanZone = timezone === 'default' ?
239
+ // @ts-ignore
240
+ this.moment.defaultZone?.name ?? 'system' : timezone;
241
+ if (cleanZone === 'system') {
242
+ return value.clone().local();
243
+ }
244
+ const newValue = value.clone();
245
+ newValue.tz(cleanZone);
246
+ return newValue;
247
+ };
248
+ toJsDate = value => {
249
+ return value.toDate();
250
+ };
251
+ parse = (value, format) => {
252
+ if (value === '') {
253
+ return null;
254
+ }
255
+ if (this.locale) {
256
+ return this.moment(value, format, this.locale, true);
257
+ }
258
+ return this.moment(value, format, true);
259
+ };
260
+ getCurrentLocaleCode = () => {
261
+ return this.locale || defaultMoment.locale();
262
+ };
263
+ is12HourCycleInCurrentLocale = () => {
264
+ return /A|a/.test(defaultMoment.localeData(this.getCurrentLocaleCode()).longDateFormat('LT'));
265
+ };
266
+ expandFormat = format => {
267
+ // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
268
+ const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
269
+ return format.match(localFormattingTokens).map(token => {
270
+ const firstCharacter = token[0];
271
+ if (firstCharacter === 'L' || firstCharacter === ';') {
272
+ return defaultMoment.localeData(this.getCurrentLocaleCode()).longDateFormat(token);
300
273
  }
301
- return value.isSame(comparing);
302
- };
303
- this.isSameYear = (value, comparing) => {
304
- return value.isSame(comparing, 'year');
305
- };
306
- this.isSameMonth = (value, comparing) => {
307
- return value.isSame(comparing, 'month');
308
- };
309
- this.isSameDay = (value, comparing) => {
310
- return value.isSame(comparing, 'day');
311
- };
312
- this.isSameHour = (value, comparing) => {
313
- return value.isSame(comparing, 'hour');
314
- };
315
- this.isAfter = (value, comparing) => {
316
- return value.isAfter(comparing);
317
- };
318
- this.isAfterYear = (value, comparing) => {
319
- return value.isAfter(comparing, 'year');
320
- };
321
- this.isAfterDay = (value, comparing) => {
322
- return value.isAfter(comparing, 'day');
323
- };
324
- this.isBefore = (value, comparing) => {
325
- return value.isBefore(comparing);
326
- };
327
- this.isBeforeYear = (value, comparing) => {
328
- return value.isBefore(comparing, 'year');
329
- };
330
- this.isBeforeDay = (value, comparing) => {
331
- return value.isBefore(comparing, 'day');
332
- };
333
- this.isWithinRange = (value, [start, end]) => {
334
- return value.isBetween(start, end, null, '[]');
335
- };
336
- this.startOfYear = value => {
337
- return value.clone().startOf('year');
338
- };
339
- this.startOfMonth = value => {
340
- return value.clone().startOf('month');
341
- };
342
- this.startOfWeek = value => {
343
- return this.setLocaleToValue(value.clone()).startOf('week');
344
- };
345
- this.startOfDay = value => {
346
- return value.clone().startOf('day');
347
- };
348
- this.endOfYear = value => {
349
- return value.clone().endOf('year');
350
- };
351
- this.endOfMonth = value => {
352
- return value.clone().endOf('month');
353
- };
354
- this.endOfWeek = value => {
355
- return this.setLocaleToValue(value.clone()).endOf('week');
356
- };
357
- this.endOfDay = value => {
358
- return value.clone().endOf('day');
359
- };
360
- this.addYears = (value, amount) => {
361
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'years') : value.clone().add(amount, 'years');
362
- };
363
- this.addMonths = (value, amount) => {
364
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'months') : value.clone().add(amount, 'months');
365
- };
366
- this.addWeeks = (value, amount) => {
367
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'weeks') : value.clone().add(amount, 'weeks');
368
- };
369
- this.addDays = (value, amount) => {
370
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'days') : value.clone().add(amount, 'days');
371
- };
372
- this.addHours = (value, amount) => {
373
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'hours') : value.clone().add(amount, 'hours');
374
- };
375
- this.addMinutes = (value, amount) => {
376
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'minutes') : value.clone().add(amount, 'minutes');
377
- };
378
- this.addSeconds = (value, amount) => {
379
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'seconds') : value.clone().add(amount, 'seconds');
380
- };
381
- this.getYear = value => {
382
- return value.get('year');
383
- };
384
- this.getMonth = value => {
385
- return value.get('month');
386
- };
387
- this.getDate = value => {
388
- return value.get('date');
389
- };
390
- this.getHours = value => {
391
- return value.get('hours');
392
- };
393
- this.getMinutes = value => {
394
- return value.get('minutes');
395
- };
396
- this.getSeconds = value => {
397
- return value.get('seconds');
398
- };
399
- this.getMilliseconds = value => {
400
- return value.get('milliseconds');
401
- };
402
- this.setYear = (value, year) => {
403
- return value.clone().year(year);
404
- };
405
- this.setMonth = (value, month) => {
406
- return value.clone().month(month);
407
- };
408
- this.setDate = (value, date) => {
409
- return value.clone().date(date);
410
- };
411
- this.setHours = (value, hours) => {
412
- return value.clone().hours(hours);
413
- };
414
- this.setMinutes = (value, minutes) => {
415
- return value.clone().minutes(minutes);
416
- };
417
- this.setSeconds = (value, seconds) => {
418
- return value.clone().seconds(seconds);
419
- };
420
- this.setMilliseconds = (value, milliseconds) => {
421
- return value.clone().milliseconds(milliseconds);
422
- };
423
- this.getDaysInMonth = value => {
424
- return value.daysInMonth();
425
- };
426
- this.getWeekArray = value => {
427
- const start = this.startOfWeek(this.startOfMonth(value));
428
- const end = this.endOfWeek(this.endOfMonth(value));
429
- let count = 0;
430
- let current = start;
431
- let currentDayOfYear = current.get('dayOfYear');
432
- const nestedWeeks = [];
433
- while (current.isBefore(end)) {
434
- const weekNumber = Math.floor(count / 7);
435
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
436
- nestedWeeks[weekNumber].push(current);
437
- const prevDayOfYear = currentDayOfYear;
438
- current = this.addDays(current, 1);
439
- currentDayOfYear = current.get('dayOfYear');
274
+ return token;
275
+ }).join('');
276
+ };
277
+ isValid = value => {
278
+ if (value == null) {
279
+ return false;
280
+ }
281
+ return value.isValid();
282
+ };
283
+ format = (value, formatKey) => {
284
+ return this.formatByString(value, this.formats[formatKey]);
285
+ };
286
+ formatByString = (value, formatString) => {
287
+ const clonedDate = value.clone();
288
+ clonedDate.locale(this.getCurrentLocaleCode());
289
+ return clonedDate.format(formatString);
290
+ };
291
+ formatNumber = numberToFormat => {
292
+ return numberToFormat;
293
+ };
294
+ isEqual = (value, comparing) => {
295
+ if (value === null && comparing === null) {
296
+ return true;
297
+ }
298
+ if (value === null || comparing === null) {
299
+ return false;
300
+ }
301
+ return value.isSame(comparing);
302
+ };
303
+ isSameYear = (value, comparing) => {
304
+ return value.isSame(comparing, 'year');
305
+ };
306
+ isSameMonth = (value, comparing) => {
307
+ return value.isSame(comparing, 'month');
308
+ };
309
+ isSameDay = (value, comparing) => {
310
+ return value.isSame(comparing, 'day');
311
+ };
312
+ isSameHour = (value, comparing) => {
313
+ return value.isSame(comparing, 'hour');
314
+ };
315
+ isAfter = (value, comparing) => {
316
+ return value.isAfter(comparing);
317
+ };
318
+ isAfterYear = (value, comparing) => {
319
+ return value.isAfter(comparing, 'year');
320
+ };
321
+ isAfterDay = (value, comparing) => {
322
+ return value.isAfter(comparing, 'day');
323
+ };
324
+ isBefore = (value, comparing) => {
325
+ return value.isBefore(comparing);
326
+ };
327
+ isBeforeYear = (value, comparing) => {
328
+ return value.isBefore(comparing, 'year');
329
+ };
330
+ isBeforeDay = (value, comparing) => {
331
+ return value.isBefore(comparing, 'day');
332
+ };
333
+ isWithinRange = (value, [start, end]) => {
334
+ return value.isBetween(start, end, null, '[]');
335
+ };
336
+ startOfYear = value => {
337
+ return value.clone().startOf('year');
338
+ };
339
+ startOfMonth = value => {
340
+ return value.clone().startOf('month');
341
+ };
342
+ startOfWeek = value => {
343
+ return this.setLocaleToValue(value.clone()).startOf('week');
344
+ };
345
+ startOfDay = value => {
346
+ return value.clone().startOf('day');
347
+ };
348
+ endOfYear = value => {
349
+ return value.clone().endOf('year');
350
+ };
351
+ endOfMonth = value => {
352
+ return value.clone().endOf('month');
353
+ };
354
+ endOfWeek = value => {
355
+ return this.setLocaleToValue(value.clone()).endOf('week');
356
+ };
357
+ endOfDay = value => {
358
+ return value.clone().endOf('day');
359
+ };
360
+ addYears = (value, amount) => {
361
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'years') : value.clone().add(amount, 'years');
362
+ };
363
+ addMonths = (value, amount) => {
364
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'months') : value.clone().add(amount, 'months');
365
+ };
366
+ addWeeks = (value, amount) => {
367
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'weeks') : value.clone().add(amount, 'weeks');
368
+ };
369
+ addDays = (value, amount) => {
370
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'days') : value.clone().add(amount, 'days');
371
+ };
372
+ addHours = (value, amount) => {
373
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'hours') : value.clone().add(amount, 'hours');
374
+ };
375
+ addMinutes = (value, amount) => {
376
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'minutes') : value.clone().add(amount, 'minutes');
377
+ };
378
+ addSeconds = (value, amount) => {
379
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'seconds') : value.clone().add(amount, 'seconds');
380
+ };
381
+ getYear = value => {
382
+ return value.get('year');
383
+ };
384
+ getMonth = value => {
385
+ return value.get('month');
386
+ };
387
+ getDate = value => {
388
+ return value.get('date');
389
+ };
390
+ getHours = value => {
391
+ return value.get('hours');
392
+ };
393
+ getMinutes = value => {
394
+ return value.get('minutes');
395
+ };
396
+ getSeconds = value => {
397
+ return value.get('seconds');
398
+ };
399
+ getMilliseconds = value => {
400
+ return value.get('milliseconds');
401
+ };
402
+ setYear = (value, year) => {
403
+ return value.clone().year(year);
404
+ };
405
+ setMonth = (value, month) => {
406
+ return value.clone().month(month);
407
+ };
408
+ setDate = (value, date) => {
409
+ return value.clone().date(date);
410
+ };
411
+ setHours = (value, hours) => {
412
+ return value.clone().hours(hours);
413
+ };
414
+ setMinutes = (value, minutes) => {
415
+ return value.clone().minutes(minutes);
416
+ };
417
+ setSeconds = (value, seconds) => {
418
+ return value.clone().seconds(seconds);
419
+ };
420
+ setMilliseconds = (value, milliseconds) => {
421
+ return value.clone().milliseconds(milliseconds);
422
+ };
423
+ getDaysInMonth = value => {
424
+ return value.daysInMonth();
425
+ };
426
+ getWeekArray = value => {
427
+ const start = this.startOfWeek(this.startOfMonth(value));
428
+ const end = this.endOfWeek(this.endOfMonth(value));
429
+ let count = 0;
430
+ let current = start;
431
+ let currentDayOfYear = current.get('dayOfYear');
432
+ const nestedWeeks = [];
433
+ while (current.isBefore(end)) {
434
+ const weekNumber = Math.floor(count / 7);
435
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
436
+ nestedWeeks[weekNumber].push(current);
437
+ const prevDayOfYear = currentDayOfYear;
438
+ current = this.addDays(current, 1);
439
+ currentDayOfYear = current.get('dayOfYear');
440
440
 
441
- // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
442
- // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
443
- // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
444
- if (prevDayOfYear === currentDayOfYear) {
445
- current = current.add(12, 'h').startOf('day');
446
- }
447
- count += 1;
441
+ // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
442
+ // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
443
+ // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
444
+ if (prevDayOfYear === currentDayOfYear) {
445
+ current = current.add(12, 'h').startOf('day');
448
446
  }
449
- return nestedWeeks;
450
- };
451
- this.getWeekNumber = value => {
452
- return value.week();
453
- };
454
- this.getDayOfWeek = value => {
455
- return value.day() + 1;
456
- };
457
- this.moment = instance || defaultMoment;
458
- this.locale = locale;
459
- this.formats = _extends({}, defaultFormats, formats);
460
- }
447
+ count += 1;
448
+ }
449
+ return nestedWeeks;
450
+ };
451
+ getWeekNumber = value => {
452
+ return value.week();
453
+ };
454
+ getDayOfWeek = value => {
455
+ return value.day() + 1;
456
+ };
461
457
  getYearRange([start, end]) {
462
458
  const startDate = this.startOfYear(start);
463
459
  const endDate = this.endOfYear(end);