@mui/x-date-pickers 7.0.0-alpha.0 → 7.0.0-alpha.1

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 (125) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +4 -15
  2. package/AdapterDateFns/AdapterDateFns.js +8 -90
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +4 -15
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
  5. package/AdapterDayjs/AdapterDayjs.d.ts +5 -17
  6. package/AdapterDayjs/AdapterDayjs.js +11 -60
  7. package/AdapterLuxon/AdapterLuxon.d.ts +4 -15
  8. package/AdapterLuxon/AdapterLuxon.js +3 -73
  9. package/AdapterMoment/AdapterMoment.d.ts +4 -20
  10. package/AdapterMoment/AdapterMoment.js +9 -66
  11. package/AdapterMomentHijri/AdapterMomentHijri.d.ts +1 -7
  12. package/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
  13. package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +1 -9
  14. package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
  15. package/CHANGELOG.md +409 -1
  16. package/DateCalendar/DateCalendar.js +0 -1
  17. package/DateCalendar/DayCalendar.d.ts +1 -2
  18. package/DateCalendar/DayCalendar.js +9 -16
  19. package/DateCalendar/index.d.ts +0 -1
  20. package/DateCalendar/index.js +1 -3
  21. package/DatePicker/DatePicker.js +0 -1
  22. package/DatePicker/shared.d.ts +1 -1
  23. package/DateTimePicker/DateTimePicker.js +0 -1
  24. package/DateTimePicker/shared.d.ts +1 -1
  25. package/DesktopDatePicker/DesktopDatePicker.js +0 -1
  26. package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  27. package/DigitalClock/DigitalClock.js +3 -2
  28. package/LocalizationProvider/LocalizationProvider.js +0 -6
  29. package/MobileDatePicker/MobileDatePicker.js +0 -1
  30. package/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  31. package/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  32. package/StaticDatePicker/StaticDatePicker.js +0 -1
  33. package/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  34. package/TimePicker/shared.d.ts +1 -1
  35. package/YearCalendar/YearCalendar.js +1 -1
  36. package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +1 -1
  37. package/index.d.ts +1 -0
  38. package/index.js +4 -1
  39. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -0
  40. package/internals/hooks/useField/useField.utils.js +0 -1
  41. package/internals/hooks/useField/useFieldState.js +1 -1
  42. package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
  43. package/internals/utils/getDefaultReferenceDate.js +0 -4
  44. package/legacy/AdapterDateFns/AdapterDateFns.js +11 -92
  45. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +11 -92
  46. package/legacy/AdapterDayjs/AdapterDayjs.js +15 -63
  47. package/legacy/AdapterLuxon/AdapterLuxon.js +6 -75
  48. package/legacy/AdapterMoment/AdapterMoment.js +12 -70
  49. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -30
  50. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -40
  51. package/legacy/DateCalendar/DateCalendar.js +0 -1
  52. package/legacy/DateCalendar/DayCalendar.js +7 -11
  53. package/legacy/DateCalendar/index.js +1 -3
  54. package/legacy/DatePicker/DatePicker.js +0 -1
  55. package/legacy/DateTimePicker/DateTimePicker.js +0 -1
  56. package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -1
  57. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  58. package/legacy/DigitalClock/DigitalClock.js +3 -2
  59. package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
  60. package/legacy/MobileDatePicker/MobileDatePicker.js +0 -1
  61. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  62. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +11 -3
  63. package/legacy/StaticDatePicker/StaticDatePicker.js +0 -1
  64. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  65. package/legacy/YearCalendar/YearCalendar.js +1 -1
  66. package/legacy/index.js +4 -1
  67. package/legacy/internals/hooks/useField/useField.utils.js +0 -1
  68. package/legacy/internals/hooks/useField/useFieldState.js +1 -1
  69. package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
  70. package/models/adapters.d.ts +10 -135
  71. package/models/fields.d.ts +0 -6
  72. package/modern/AdapterDateFns/AdapterDateFns.js +8 -90
  73. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
  74. package/modern/AdapterDayjs/AdapterDayjs.js +11 -59
  75. package/modern/AdapterLuxon/AdapterLuxon.js +3 -73
  76. package/modern/AdapterMoment/AdapterMoment.js +9 -65
  77. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
  78. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
  79. package/modern/DateCalendar/DateCalendar.js +0 -1
  80. package/modern/DateCalendar/DayCalendar.js +9 -15
  81. package/modern/DateCalendar/index.js +1 -3
  82. package/modern/DatePicker/DatePicker.js +0 -1
  83. package/modern/DateTimePicker/DateTimePicker.js +0 -1
  84. package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -1
  85. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  86. package/modern/DigitalClock/DigitalClock.js +3 -2
  87. package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
  88. package/modern/MobileDatePicker/MobileDatePicker.js +0 -1
  89. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  90. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  91. package/modern/StaticDatePicker/StaticDatePicker.js +0 -1
  92. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  93. package/modern/YearCalendar/YearCalendar.js +1 -1
  94. package/modern/index.js +4 -1
  95. package/modern/internals/hooks/useField/useField.utils.js +0 -1
  96. package/modern/internals/hooks/useField/useFieldState.js +1 -1
  97. package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
  98. package/node/AdapterDateFns/AdapterDateFns.js +8 -90
  99. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
  100. package/node/AdapterDayjs/AdapterDayjs.js +11 -59
  101. package/node/AdapterLuxon/AdapterLuxon.js +3 -73
  102. package/node/AdapterMoment/AdapterMoment.js +9 -65
  103. package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
  104. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
  105. package/node/DateCalendar/DateCalendar.js +0 -1
  106. package/node/DateCalendar/DayCalendar.js +9 -15
  107. package/node/DateCalendar/index.js +1 -21
  108. package/node/DatePicker/DatePicker.js +0 -1
  109. package/node/DateTimePicker/DateTimePicker.js +0 -1
  110. package/node/DesktopDatePicker/DesktopDatePicker.js +0 -1
  111. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
  112. package/node/DigitalClock/DigitalClock.js +3 -2
  113. package/node/LocalizationProvider/LocalizationProvider.js +0 -6
  114. package/node/MobileDatePicker/MobileDatePicker.js +0 -1
  115. package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
  116. package/node/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
  117. package/node/StaticDatePicker/StaticDatePicker.js +0 -1
  118. package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  119. package/node/YearCalendar/YearCalendar.js +1 -1
  120. package/node/index.js +13 -1
  121. package/node/internals/hooks/useField/useField.utils.js +0 -1
  122. package/node/internals/hooks/useField/useFieldState.js +1 -1
  123. package/node/internals/utils/getDefaultReferenceDate.js +1 -3
  124. package/package.json +1 -1
  125. package/themeAugmentation/overrides.d.ts +1 -1
@@ -109,19 +109,13 @@ var defaultFormats = {
109
109
  minutes: 'mm',
110
110
  seconds: 'ss',
111
111
  fullDate: 'll',
112
- fullDateWithWeekday: 'dddd, LL',
113
112
  keyboardDate: 'L',
114
113
  shortDate: 'MMM D',
115
114
  normalDate: 'D MMMM',
116
115
  normalDateWithWeekday: 'ddd, MMM D',
117
- monthAndYear: 'MMMM YYYY',
118
- monthAndDate: 'MMMM D',
119
116
  fullTime: 'LT',
120
117
  fullTime12h: 'hh:mm A',
121
118
  fullTime24h: 'HH:mm',
122
- fullDateTime: 'lll',
123
- fullDateTime12h: 'll hh:mm A',
124
- fullDateTime24h: 'll HH:mm',
125
119
  keyboardDateTime: 'L LT',
126
120
  keyboardDateTime12h: 'L hh:mm A',
127
121
  keyboardDateTime24h: 'L HH:mm'
@@ -160,17 +154,14 @@ var withLocale = function withLocale(dayjs, locale) {
160
154
  * SOFTWARE.
161
155
  */
162
156
  export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
163
- var _this = this,
164
- _this$rawDayJsInstanc;
157
+ var _this = this;
165
158
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
166
159
  _locale = _ref.locale,
167
- formats = _ref.formats,
168
- instance = _ref.instance;
160
+ formats = _ref.formats;
169
161
  _classCallCheck(this, AdapterDayjs);
170
162
  this.isMUIAdapter = true;
171
163
  this.isTimezoneCompatible = true;
172
164
  this.lib = 'dayjs';
173
- this.rawDayJsInstance = void 0;
174
165
  this.dayjs = void 0;
175
166
  this.locale = void 0;
176
167
  this.formats = void 0;
@@ -216,11 +207,6 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
216
207
  }
217
208
  };
218
209
  this.createSystemDate = function (value) {
219
- // TODO v7: Stop using `this.rawDayJsInstance` (drop the `instance` param on the adapters)
220
- /* istanbul ignore next */
221
- if (_this.rawDayJsInstance) {
222
- return _this.rawDayJsInstance(value);
223
- }
224
210
  if (_this.hasUTCPlugin() && _this.hasTimezonePlugin()) {
225
211
  var timezone = defaultDayjs.tz.guess();
226
212
 
@@ -353,12 +339,6 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
353
339
  this.toJsDate = function (value) {
354
340
  return value.toDate();
355
341
  };
356
- this.parseISO = function (isoString) {
357
- return _this.dayjs(isoString);
358
- };
359
- this.toISO = function (value) {
360
- return value.toISOString();
361
- };
362
342
  this.parse = function (value, format) {
363
343
  if (value === '') {
364
344
  return null;
@@ -386,14 +366,11 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
386
366
  return a || localeFormats[b] || t(localeFormats[B]);
387
367
  });
388
368
  };
389
- this.getFormatHelperText = function (format) {
390
- return _this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
391
- };
392
- this.isNull = function (value) {
393
- return value === null;
394
- };
395
369
  this.isValid = function (value) {
396
- return _this.dayjs(value).isValid();
370
+ if (value == null) {
371
+ return false;
372
+ }
373
+ return value.isValid();
397
374
  };
398
375
  this.format = function (value, formatKey) {
399
376
  return _this.formatByString(value, _this.formats[formatKey]);
@@ -404,14 +381,14 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
404
381
  this.formatNumber = function (numberToFormat) {
405
382
  return numberToFormat;
406
383
  };
407
- this.getDiff = function (value, comparing, unit) {
408
- return value.diff(comparing, unit);
409
- };
410
384
  this.isEqual = function (value, comparing) {
411
385
  if (value === null && comparing === null) {
412
386
  return true;
413
387
  }
414
- return _this.dayjs(value).toDate().getTime() === _this.dayjs(comparing).toDate().getTime();
388
+ if (value === null || comparing === null) {
389
+ return false;
390
+ }
391
+ return value.toDate().getTime() === comparing.toDate().getTime();
415
392
  };
416
393
  this.isSameYear = function (value, comparing) {
417
394
  return _this.isSame(value, comparing, 'YYYY');
@@ -551,30 +528,6 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
551
528
  this.getDaysInMonth = function (value) {
552
529
  return value.daysInMonth();
553
530
  };
554
- this.getNextMonth = function (value) {
555
- return _this.addMonths(value, 1);
556
- };
557
- this.getPreviousMonth = function (value) {
558
- return _this.addMonths(value, -1);
559
- };
560
- this.getMonthArray = function (value) {
561
- var firstMonth = value.startOf('year');
562
- var monthArray = [firstMonth];
563
- while (monthArray.length < 12) {
564
- var prevMonth = monthArray[monthArray.length - 1];
565
- monthArray.push(_this.addMonths(prevMonth, 1));
566
- }
567
- return monthArray;
568
- };
569
- this.mergeDateAndTime = function (dateParam, timeParam) {
570
- return dateParam.hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
571
- };
572
- this.getWeekdays = function () {
573
- var start = _this.dayjs().startOf('week');
574
- return [0, 1, 2, 3, 4, 5, 6].map(function (diff) {
575
- return _this.formatByString(_this.addDays(start, diff), 'dd');
576
- });
577
- };
578
531
  this.getWeekArray = function (value) {
579
532
  var cleanValue = _this.setLocaleToValue(value);
580
533
  var start = cleanValue.startOf('month').startOf('week');
@@ -594,7 +547,10 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
594
547
  this.getWeekNumber = function (value) {
595
548
  return value.week();
596
549
  };
597
- this.getYearRange = function (start, end) {
550
+ this.getYearRange = function (_ref4) {
551
+ var _ref5 = _slicedToArray(_ref4, 2),
552
+ start = _ref5[0],
553
+ end = _ref5[1];
598
554
  var startDate = start.startOf('year');
599
555
  var endDate = end.endOf('year');
600
556
  var years = [];
@@ -605,11 +561,7 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
605
561
  }
606
562
  return years;
607
563
  };
608
- this.getMeridiemText = function (ampm) {
609
- return ampm === 'am' ? 'AM' : 'PM';
610
- };
611
- this.rawDayJsInstance = instance;
612
- this.dayjs = withLocale((_this$rawDayJsInstanc = this.rawDayJsInstance) != null ? _this$rawDayJsInstanc : defaultDayjs, _locale);
564
+ this.dayjs = withLocale(defaultDayjs, _locale);
613
565
  this.locale = _locale;
614
566
  this.formats = _extends({}, defaultFormats, formats);
615
567
  defaultDayjs.extend(weekOfYear);
@@ -123,19 +123,13 @@ var defaultFormats = {
123
123
  minutes: 'mm',
124
124
  seconds: 'ss',
125
125
  fullDate: 'DD',
126
- fullDateWithWeekday: 'DDDD',
127
126
  keyboardDate: 'D',
128
127
  shortDate: 'MMM d',
129
128
  normalDate: 'd MMMM',
130
129
  normalDateWithWeekday: 'EEE, MMM d',
131
- monthAndYear: 'LLLL yyyy',
132
- monthAndDate: 'MMMM d',
133
130
  fullTime: 't',
134
131
  fullTime12h: 'hh:mm a',
135
132
  fullTime24h: 'HH:mm',
136
- fullDateTime: 'ff',
137
- fullDateTime12h: 'DD, hh:mm a',
138
- fullDateTime24h: 'DD, T',
139
133
  keyboardDateTime: 'D t',
140
134
  keyboardDateTime12h: 'D hh:mm a',
141
135
  keyboardDateTime24h: 'D T'
@@ -245,14 +239,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
245
239
  this.toJsDate = function (value) {
246
240
  return value.toJSDate();
247
241
  };
248
- this.parseISO = function (isoString) {
249
- return DateTime.fromISO(isoString);
250
- };
251
- this.toISO = function (value) {
252
- return value.toUTC().toISO({
253
- format: 'extended'
254
- });
255
- };
256
242
  this.parse = function (value, formatString) {
257
243
  if (value === '') {
258
244
  return null;
@@ -302,20 +288,11 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
302
288
  // To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
303
289
  .replace('yyyyy', 'yyyy');
304
290
  };
305
- this.getFormatHelperText = function (format) {
306
- return _this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
307
- };
308
- this.isNull = function (value) {
309
- return value === null;
310
- };
311
291
  this.isValid = function (value) {
312
- if (DateTime.isDateTime(value)) {
313
- return value.isValid;
314
- }
315
292
  if (value === null) {
316
293
  return false;
317
294
  }
318
- return _this.isValid(_this.date(value));
295
+ return value.isValid;
319
296
  };
320
297
  this.format = function (value, formatKey) {
321
298
  return _this.formatByString(value, _this.formats[formatKey]);
@@ -326,25 +303,14 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
326
303
  this.formatNumber = function (numberToFormat) {
327
304
  return numberToFormat;
328
305
  };
329
- this.getDiff = function (value, comparing, unit) {
330
- if (typeof comparing === 'string') {
331
- comparing = DateTime.fromJSDate(new Date(comparing));
332
- }
333
- if (unit) {
334
- return Math.floor(value.diff(comparing).as(unit));
335
- }
336
- return value.diff(comparing).as('millisecond');
337
- };
338
306
  this.isEqual = function (value, comparing) {
339
307
  if (value === null && comparing === null) {
340
308
  return true;
341
309
  }
342
-
343
- // Make sure that null will not be passed to this.date
344
310
  if (value === null || comparing === null) {
345
311
  return false;
346
312
  }
347
- return +_this.date(value) === +_this.date(comparing);
313
+ return +value === +comparing;
348
314
  };
349
315
  this.isSameYear = function (value, comparing) {
350
316
  var comparingInValueTimezone = _this.setTimezone(comparing, _this.getTimezone(value));
@@ -513,37 +479,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
513
479
  this.getDaysInMonth = function (value) {
514
480
  return value.daysInMonth;
515
481
  };
516
- this.getNextMonth = function (value) {
517
- return value.plus({
518
- months: 1
519
- });
520
- };
521
- this.getPreviousMonth = function (value) {
522
- return value.minus({
523
- months: 1
524
- });
525
- };
526
- this.getMonthArray = function (value) {
527
- var firstMonth = value.startOf('year');
528
- var monthArray = [firstMonth];
529
- while (monthArray.length < 12) {
530
- var prevMonth = monthArray[monthArray.length - 1];
531
- monthArray.push(_this.addMonths(prevMonth, 1));
532
- }
533
- return monthArray;
534
- };
535
- this.mergeDateAndTime = function (dateParam, timeParam) {
536
- return dateParam.set({
537
- second: timeParam.second,
538
- hour: timeParam.hour,
539
- minute: timeParam.minute
540
- });
541
- };
542
- this.getWeekdays = function () {
543
- return Info.weekdaysFormat('narrow', {
544
- locale: _this.locale
545
- });
546
- };
547
482
  this.getWeekArray = function (value) {
548
483
  var cleanValue = _this.setLocaleToValue(value);
549
484
  var _cleanValue$endOf$end = cleanValue.endOf('month').endOf('week').diff(cleanValue.startOf('month').startOf('week'), 'days').toObject(),
@@ -567,7 +502,10 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
567
502
  this.getWeekNumber = function (value) {
568
503
  return value.weekNumber;
569
504
  };
570
- this.getYearRange = function (start, end) {
505
+ this.getYearRange = function (_ref4) {
506
+ var _ref5 = _slicedToArray(_ref4, 2),
507
+ start = _ref5[0],
508
+ end = _ref5[1];
571
509
  var startDate = start.startOf('year');
572
510
  var endDate = end.endOf('year');
573
511
  var current = startDate;
@@ -580,13 +518,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
580
518
  }
581
519
  return years;
582
520
  };
583
- this.getMeridiemText = function (ampm) {
584
- return Info.meridiems({
585
- locale: _this.locale
586
- }).find(function (v) {
587
- return v.toLowerCase() === ampm.toLowerCase();
588
- });
589
- };
590
521
  this.locale = locale || 'en-US';
591
522
  this.formats = _extends({}, defaultFormats, formats);
592
523
  });
@@ -112,19 +112,13 @@ var defaultFormats = {
112
112
  minutes: 'mm',
113
113
  seconds: 'ss',
114
114
  fullDate: 'll',
115
- fullDateWithWeekday: 'dddd, LL',
116
115
  keyboardDate: 'L',
117
116
  shortDate: 'MMM D',
118
117
  normalDate: 'D MMMM',
119
118
  normalDateWithWeekday: 'ddd, MMM D',
120
- monthAndYear: 'MMMM YYYY',
121
- monthAndDate: 'MMMM D',
122
119
  fullTime: 'LT',
123
120
  fullTime12h: 'hh:mm A',
124
121
  fullTime24h: 'HH:mm',
125
- fullDateTime: 'lll',
126
- fullDateTime12h: 'll hh:mm A',
127
- fullDateTime24h: 'll HH:mm',
128
122
  keyboardDateTime: 'L LT',
129
123
  keyboardDateTime12h: 'L hh:mm A',
130
124
  keyboardDateTime24h: 'L HH:mm'
@@ -181,22 +175,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
181
175
  }
182
176
  return value.locale(expectedLocale);
183
177
  };
184
- /**
185
- * Some methods from moment can't take the locale as a parameter and always use the current locale.
186
- * To respect the adapter locale, we need to set it as the current locale and then reset the previous locale.
187
- */
188
- this.syncMomentLocale = function (runner) {
189
- var _this$locale;
190
- var momentLocale = defaultMoment.locale();
191
- var adapterLocale = (_this$locale = _this.locale) != null ? _this$locale : 'en-us';
192
- if (momentLocale !== adapterLocale) {
193
- defaultMoment.locale(adapterLocale);
194
- var result = runner();
195
- defaultMoment.locale(momentLocale);
196
- return result;
197
- }
198
- return runner();
199
- };
200
178
  this.hasTimezonePlugin = function () {
201
179
  return typeof _this.moment.tz !== 'undefined';
202
180
  };
@@ -285,12 +263,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
285
263
  this.toJsDate = function (value) {
286
264
  return value.toDate();
287
265
  };
288
- this.parseISO = function (isoString) {
289
- return _this.moment(isoString, true);
290
- };
291
- this.toISO = function (value) {
292
- return value.toISOString();
293
- };
294
266
  this.parse = function (value, format) {
295
267
  if (value === '') {
296
268
  return null;
@@ -317,14 +289,11 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
317
289
  return token;
318
290
  }).join('');
319
291
  };
320
- this.getFormatHelperText = function (format) {
321
- return _this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
322
- };
323
- this.isNull = function (value) {
324
- return value === null;
325
- };
326
292
  this.isValid = function (value) {
327
- return _this.moment(value).isValid();
293
+ if (value == null) {
294
+ return false;
295
+ }
296
+ return value.isValid();
328
297
  };
329
298
  this.format = function (value, formatKey) {
330
299
  return _this.formatByString(value, _this.formats[formatKey]);
@@ -337,14 +306,14 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
337
306
  this.formatNumber = function (numberToFormat) {
338
307
  return numberToFormat;
339
308
  };
340
- this.getDiff = function (value, comparing, unit) {
341
- return value.diff(comparing, unit);
342
- };
343
309
  this.isEqual = function (value, comparing) {
344
310
  if (value === null && comparing === null) {
345
311
  return true;
346
312
  }
347
- return _this.moment(value).isSame(comparing);
313
+ if (value === null || comparing === null) {
314
+ return false;
315
+ }
316
+ return value.isSame(comparing);
348
317
  };
349
318
  this.isSameYear = function (value, comparing) {
350
319
  return value.isSame(comparing, 'year');
@@ -472,29 +441,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
472
441
  this.getDaysInMonth = function (value) {
473
442
  return value.daysInMonth();
474
443
  };
475
- this.getNextMonth = function (value) {
476
- return value.clone().add(1, 'month');
477
- };
478
- this.getPreviousMonth = function (value) {
479
- return value.clone().subtract(1, 'month');
480
- };
481
- this.getMonthArray = function (value) {
482
- var firstMonth = _this.startOfYear(value);
483
- var monthArray = [firstMonth];
484
- while (monthArray.length < 12) {
485
- var prevMonth = monthArray[monthArray.length - 1];
486
- monthArray.push(_this.getNextMonth(prevMonth));
487
- }
488
- return monthArray;
489
- };
490
- this.mergeDateAndTime = function (dateParam, timeParam) {
491
- return dateParam.clone().hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
492
- };
493
- this.getWeekdays = function () {
494
- return _this.syncMomentLocale(function () {
495
- return defaultMoment.weekdaysShort(true);
496
- });
497
- };
498
444
  this.getWeekArray = function (value) {
499
445
  var cleanValue = _this.setLocaleToValue(value);
500
446
  var start = cleanValue.clone().startOf('month').startOf('week');
@@ -514,7 +460,10 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
514
460
  this.getWeekNumber = function (value) {
515
461
  return value.week();
516
462
  };
517
- this.getYearRange = function (start, end) {
463
+ this.getYearRange = function (_ref5) {
464
+ var _ref6 = _slicedToArray(_ref5, 2),
465
+ start = _ref6[0],
466
+ end = _ref6[1];
518
467
  var startDate = _this.moment(start).startOf('year');
519
468
  var endDate = _this.moment(end).endOf('year');
520
469
  var years = [];
@@ -525,13 +474,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
525
474
  }
526
475
  return years;
527
476
  };
528
- this.getMeridiemText = function (ampm) {
529
- if (_this.is12HourCycleInCurrentLocale()) {
530
- // AM/PM translation only possible in those who have 12 hour cycle in locale.
531
- return defaultMoment.localeData(_this.getCurrentLocaleCode()).meridiem(ampm === 'am' ? 0 : 13, 0, false);
532
- }
533
- return ampm === 'am' ? 'AM' : 'PM'; // fallback for de, ru, ...etc
534
- };
535
477
  this.moment = instance || defaultMoment;
536
478
  this.locale = locale;
537
479
  this.formats = _extends({}, defaultFormats, formats);
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -86,19 +87,13 @@ var defaultFormats = {
86
87
  minutes: 'mm',
87
88
  seconds: 'ss',
88
89
  fullDate: 'iYYYY, iMMMM Do',
89
- fullDateWithWeekday: 'iYYYY, iMMMM Do, dddd',
90
90
  keyboardDateTime: 'iYYYY/iMM/iDD LT',
91
91
  shortDate: 'iD iMMM',
92
92
  normalDate: 'dddd, iD iMMM',
93
93
  normalDateWithWeekday: 'DD iMMMM',
94
- monthAndYear: 'iMMMM iYYYY',
95
- monthAndDate: 'iD iMMMM',
96
94
  fullTime: 'LT',
97
95
  fullTime12h: 'hh:mm A',
98
96
  fullTime24h: 'HH:mm',
99
- fullDateTime: 'iYYYY, iMMMM Do, hh:mm A',
100
- fullDateTime12h: 'iD iMMMM hh:mm A',
101
- fullDateTime24h: 'iD iMMMM HH:mm',
102
97
  keyboardDate: 'iYYYY/iMM/iDD',
103
98
  keyboardDateTime12h: 'iYYYY/iMM/iDD hh:mm A',
104
99
  keyboardDateTime24h: 'iYYYY/iMM/iDD HH:mm'
@@ -179,20 +174,11 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
179
174
  }
180
175
  return _this.moment(value, format, true).locale('ar-SA');
181
176
  };
182
- _this.getFormatHelperText = function (format) {
183
- return _this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
184
- };
185
177
  _this.formatNumber = function (numberToFormat) {
186
178
  return numberToFormat.replace(/\d/g, function (match) {
187
179
  return NUMBER_SYMBOL_MAP[match];
188
180
  }).replace(/,/g, '،');
189
181
  };
190
- _this.isEqual = function (value, comparing) {
191
- if (value === null && comparing === null) {
192
- return true;
193
- }
194
- return _this.moment(value).isSame(comparing);
195
- };
196
182
  _this.startOfYear = function (value) {
197
183
  return value.clone().startOf('iYear');
198
184
  };
@@ -229,17 +215,6 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
229
215
  _this.setDate = function (value, date) {
230
216
  return value.clone().iDate(date);
231
217
  };
232
- _this.getNextMonth = function (value) {
233
- return value.clone().add(1, 'iMonth');
234
- };
235
- _this.getPreviousMonth = function (value) {
236
- return value.clone().subtract(1, 'iMonth');
237
- };
238
- _this.getWeekdays = function () {
239
- return [0, 1, 2, 3, 4, 5, 6].map(function (dayOfWeek) {
240
- return _this.date().weekday(dayOfWeek).format('dd');
241
- });
242
- };
243
218
  _this.getWeekArray = function (value) {
244
219
  var start = value.clone().startOf('iMonth').startOf('week');
245
220
  var end = value.clone().endOf('iMonth').endOf('week');
@@ -258,7 +233,10 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
258
233
  _this.getWeekNumber = function (value) {
259
234
  return value.iWeek();
260
235
  };
261
- _this.getYearRange = function (start, end) {
236
+ _this.getYearRange = function (_ref2) {
237
+ var _ref3 = _slicedToArray(_ref2, 2),
238
+ start = _ref3[0],
239
+ end = _ref3[1];
262
240
  // moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
263
241
  // We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
264
242
  if (start.isBefore('1937-03-14')) {
@@ -277,9 +255,6 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
277
255
  }
278
256
  return years;
279
257
  };
280
- _this.getMeridiemText = function (ampm) {
281
- return ampm === 'am' ? _this.date().hours(2).format('A') : _this.date().hours(14).format('A');
282
- };
283
258
  _this.moment = instance || defaultHMoment;
284
259
  _this.locale = 'ar-SA';
285
260
  _this.formats = _extends({}, defaultFormats, formats);
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -84,19 +85,13 @@ var defaultFormats = {
84
85
  minutes: 'mm',
85
86
  seconds: 'ss',
86
87
  fullDate: 'jYYYY, jMMMM Do',
87
- fullDateWithWeekday: 'dddd Do jMMMM jYYYY',
88
88
  keyboardDate: 'jYYYY/jMM/jDD',
89
89
  shortDate: 'jD jMMM',
90
90
  normalDate: 'dddd, jD jMMM',
91
91
  normalDateWithWeekday: 'DD MMMM',
92
- monthAndYear: 'jMMMM jYYYY',
93
- monthAndDate: 'jD jMMMM',
94
92
  fullTime: 'LT',
95
93
  fullTime12h: 'hh:mm A',
96
94
  fullTime24h: 'HH:mm',
97
- fullDateTime: 'jYYYY, jMMMM Do, hh:mm A',
98
- fullDateTime12h: 'jD jMMMM hh:mm A',
99
- fullDateTime24h: 'jD jMMMM HH:mm',
100
95
  keyboardDateTime: 'jYYYY/jMM/jDD LT',
101
96
  keyboardDateTime12h: 'jYYYY/jMM/jDD hh:mm A',
102
97
  keyboardDateTime24h: 'jYYYY/jMM/jDD HH:mm'
@@ -171,36 +166,17 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
171
166
  _this.setTimezone = function (value) {
172
167
  return value;
173
168
  };
174
- _this.parseISO = function (isoString) {
175
- return _this.moment(isoString).locale('fa');
176
- };
177
169
  _this.parse = function (value, format) {
178
170
  if (value === '') {
179
171
  return null;
180
172
  }
181
173
  return _this.moment(value, format, true).locale('fa');
182
174
  };
183
- _this.getFormatHelperText = function (format) {
184
- return _this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
185
- };
186
- _this.isValid = function (value) {
187
- // We can't to `this.moment(value)` because moment-jalaali looses the invalidity information when creating a new moment object from an existing one
188
- if (!_this.moment.isMoment(value)) {
189
- return false;
190
- }
191
- return value.isValid();
192
- };
193
175
  _this.formatNumber = function (numberToFormat) {
194
176
  return numberToFormat.replace(/\d/g, function (match) {
195
177
  return NUMBER_SYMBOL_MAP[match];
196
178
  }).replace(/,/g, '،');
197
179
  };
198
- _this.isEqual = function (value, comparing) {
199
- if (value === null && comparing === null) {
200
- return true;
201
- }
202
- return _this.moment(value).isSame(comparing);
203
- };
204
180
  _this.isSameYear = function (value, comparing) {
205
181
  // `isSame` seems to mutate the date on `moment-jalaali`
206
182
  // @ts-ignore
@@ -253,17 +229,6 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
253
229
  _this.setDate = function (value, date) {
254
230
  return value.clone().jDate(date);
255
231
  };
256
- _this.getNextMonth = function (value) {
257
- return value.clone().add(1, 'jMonth');
258
- };
259
- _this.getPreviousMonth = function (value) {
260
- return value.clone().subtract(1, 'jMonth');
261
- };
262
- _this.getWeekdays = function () {
263
- return [0, 1, 2, 3, 4, 5, 6].map(function (dayOfWeek) {
264
- return _this.date().weekday(dayOfWeek).format('dd');
265
- });
266
- };
267
232
  _this.getWeekArray = function (value) {
268
233
  var start = value.clone().startOf('jMonth').startOf('week');
269
234
  var end = value.clone().endOf('jMonth').endOf('week');
@@ -282,7 +247,10 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
282
247
  _this.getWeekNumber = function (value) {
283
248
  return value.jWeek();
284
249
  };
285
- _this.getYearRange = function (start, end) {
250
+ _this.getYearRange = function (_ref2) {
251
+ var _ref3 = _slicedToArray(_ref2, 2),
252
+ start = _ref3[0],
253
+ end = _ref3[1];
286
254
  var startDate = _this.moment(start).startOf('jYear');
287
255
  var endDate = _this.moment(end).endOf('jYear');
288
256
  var years = [];
@@ -293,9 +261,6 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
293
261
  }
294
262
  return years;
295
263
  };
296
- _this.getMeridiemText = function (ampm) {
297
- return ampm === 'am' ? _this.date().hours(2).format('A') : _this.date().hours(14).format('A');
298
- };
299
264
  _this.moment = instance || defaultJMoment;
300
265
  _this.locale = 'fa';
301
266
  _this.formats = _extends({}, defaultFormats, formats);
@@ -371,7 +371,6 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
371
371
  className: PropTypes.string,
372
372
  /**
373
373
  * Formats the day of week displayed in the calendar header.
374
- * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
375
374
  * @param {TDate} date The date of the day of week provided by the adapter.
376
375
  * @returns {string} The name to display.
377
376
  * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()