@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
@@ -7,16 +7,6 @@ import addHours from 'date-fns/addHours';
7
7
  import addWeeks from 'date-fns/addWeeks';
8
8
  import addMonths from 'date-fns/addMonths';
9
9
  import addYears from 'date-fns/addYears';
10
- import differenceInYears from 'date-fns/differenceInYears';
11
- import differenceInQuarters from 'date-fns/differenceInQuarters';
12
- import differenceInMonths from 'date-fns/differenceInMonths';
13
- import differenceInWeeks from 'date-fns/differenceInWeeks';
14
- import differenceInDays from 'date-fns/differenceInDays';
15
- import differenceInHours from 'date-fns/differenceInHours';
16
- import differenceInMinutes from 'date-fns/differenceInMinutes';
17
- import differenceInSeconds from 'date-fns/differenceInSeconds';
18
- import differenceInMilliseconds from 'date-fns/differenceInMilliseconds';
19
- import eachDayOfInterval from 'date-fns/eachDayOfInterval';
20
10
  import endOfDay from 'date-fns/endOfDay';
21
11
  import endOfWeek from 'date-fns/endOfWeek';
22
12
  import endOfYear from 'date-fns/endOfYear';
@@ -51,8 +41,6 @@ import startOfMonth from 'date-fns/startOfMonth';
51
41
  import endOfMonth from 'date-fns/endOfMonth';
52
42
  import startOfWeek from 'date-fns/startOfWeek';
53
43
  import startOfYear from 'date-fns/startOfYear';
54
- import parseISO from 'date-fns/parseISO';
55
- import formatISO from 'date-fns/formatISO';
56
44
  import isWithinInterval from 'date-fns/isWithinInterval';
57
45
  import defaultLocale from 'date-fns/locale/en-US';
58
46
  // @ts-ignore
@@ -235,19 +223,13 @@ const defaultFormats = {
235
223
  minutes: 'mm',
236
224
  seconds: 'ss',
237
225
  fullDate: 'PP',
238
- fullDateWithWeekday: 'PPPP',
239
226
  keyboardDate: 'P',
240
227
  shortDate: 'MMM d',
241
228
  normalDate: 'd MMMM',
242
229
  normalDateWithWeekday: 'EEE, MMM d',
243
- monthAndYear: 'LLLL yyyy',
244
- monthAndDate: 'MMMM d',
245
230
  fullTime: 'p',
246
231
  fullTime12h: 'hh:mm aa',
247
232
  fullTime24h: 'HH:mm',
248
- fullDateTime: 'PP p',
249
- fullDateTime12h: 'PP hh:mm aa',
250
- fullDateTime24h: 'PP HH:mm',
251
233
  keyboardDateTime: 'P p',
252
234
  keyboardDateTime12h: 'P hh:mm aa',
253
235
  keyboardDateTime24h: 'P HH:mm'
@@ -314,14 +296,6 @@ export class AdapterDateFns {
314
296
  this.toJsDate = value => {
315
297
  return value;
316
298
  };
317
- this.parseISO = isoString => {
318
- return parseISO(isoString);
319
- };
320
- this.toISO = value => {
321
- return formatISO(value, {
322
- format: 'extended'
323
- });
324
- };
325
299
  this.parse = (value, format) => {
326
300
  if (value === '') {
327
301
  return null;
@@ -357,14 +331,11 @@ export class AdapterDateFns {
357
331
  return token;
358
332
  }).join('');
359
333
  };
360
- this.getFormatHelperText = format => {
361
- return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
362
- };
363
- this.isNull = value => {
364
- return value === null;
365
- };
366
334
  this.isValid = value => {
367
- return isValid(this.date(value));
335
+ if (value == null) {
336
+ return false;
337
+ }
338
+ return isValid(value);
368
339
  };
369
340
  this.format = (value, formatKey) => {
370
341
  return this.formatByString(value, this.formats[formatKey]);
@@ -377,34 +348,13 @@ export class AdapterDateFns {
377
348
  this.formatNumber = numberToFormat => {
378
349
  return numberToFormat;
379
350
  };
380
- this.getDiff = (value, comparing, unit) => {
381
- switch (unit) {
382
- case 'years':
383
- return differenceInYears(value, this.date(comparing));
384
- case 'quarters':
385
- return differenceInQuarters(value, this.date(comparing));
386
- case 'months':
387
- return differenceInMonths(value, this.date(comparing));
388
- case 'weeks':
389
- return differenceInWeeks(value, this.date(comparing));
390
- case 'days':
391
- return differenceInDays(value, this.date(comparing));
392
- case 'hours':
393
- return differenceInHours(value, this.date(comparing));
394
- case 'minutes':
395
- return differenceInMinutes(value, this.date(comparing));
396
- case 'seconds':
397
- return differenceInSeconds(value, this.date(comparing));
398
- default:
399
- {
400
- return differenceInMilliseconds(value, this.date(comparing));
401
- }
402
- }
403
- };
404
351
  this.isEqual = (value, comparing) => {
405
352
  if (value === null && comparing === null) {
406
353
  return true;
407
354
  }
355
+ if (value === null || comparing === null) {
356
+ return false;
357
+ }
408
358
  return isEqual(value, comparing);
409
359
  };
410
360
  this.isSameYear = (value, comparing) => {
@@ -537,35 +487,6 @@ export class AdapterDateFns {
537
487
  this.getDaysInMonth = value => {
538
488
  return getDaysInMonth(value);
539
489
  };
540
- this.getNextMonth = value => {
541
- return addMonths(value, 1);
542
- };
543
- this.getPreviousMonth = value => {
544
- return addMonths(value, -1);
545
- };
546
- this.getMonthArray = value => {
547
- const firstMonth = startOfYear(value);
548
- const monthArray = [firstMonth];
549
- while (monthArray.length < 12) {
550
- const prevMonth = monthArray[monthArray.length - 1];
551
- monthArray.push(this.getNextMonth(prevMonth));
552
- }
553
- return monthArray;
554
- };
555
- this.mergeDateAndTime = (dateParam, timeParam) => {
556
- return this.setSeconds(this.setMinutes(this.setHours(dateParam, this.getHours(timeParam)), this.getMinutes(timeParam)), this.getSeconds(timeParam));
557
- };
558
- this.getWeekdays = () => {
559
- const now = new Date();
560
- return eachDayOfInterval({
561
- start: startOfWeek(now, {
562
- locale: this.locale
563
- }),
564
- end: endOfWeek(now, {
565
- locale: this.locale
566
- })
567
- }).map(day => this.formatByString(day, 'EEEEEE'));
568
- };
569
490
  this.getWeekArray = value => {
570
491
  const start = startOfWeek(startOfMonth(value), {
571
492
  locale: this.locale
@@ -590,7 +511,7 @@ export class AdapterDateFns {
590
511
  locale: this.locale
591
512
  });
592
513
  };
593
- this.getYearRange = (start, end) => {
514
+ this.getYearRange = ([start, end]) => {
594
515
  const startDate = startOfYear(start);
595
516
  const endDate = endOfYear(end);
596
517
  const years = [];
@@ -601,9 +522,6 @@ export class AdapterDateFns {
601
522
  }
602
523
  return years;
603
524
  };
604
- this.getMeridiemText = ampm => {
605
- return ampm === 'am' ? 'AM' : 'PM';
606
- };
607
525
  this.locale = _locale;
608
526
  this.formats = _extends({}, defaultFormats, formats);
609
527
  }
@@ -7,21 +7,10 @@ import addDays from 'date-fns-jalali/addDays';
7
7
  import addWeeks from 'date-fns-jalali/addWeeks';
8
8
  import addMonths from 'date-fns-jalali/addMonths';
9
9
  import addYears from 'date-fns-jalali/addYears';
10
- import differenceInYears from 'date-fns-jalali/differenceInYears';
11
- import differenceInQuarters from 'date-fns-jalali/differenceInQuarters';
12
- import differenceInMonths from 'date-fns-jalali/differenceInMonths';
13
- import differenceInWeeks from 'date-fns-jalali/differenceInWeeks';
14
- import differenceInDays from 'date-fns-jalali/differenceInDays';
15
- import differenceInHours from 'date-fns-jalali/differenceInHours';
16
- import differenceInMinutes from 'date-fns-jalali/differenceInMinutes';
17
- import differenceInSeconds from 'date-fns-jalali/differenceInSeconds';
18
- import differenceInMilliseconds from 'date-fns-jalali/differenceInMilliseconds';
19
- import eachDayOfInterval from 'date-fns-jalali/eachDayOfInterval';
20
10
  import endOfDay from 'date-fns-jalali/endOfDay';
21
11
  import endOfWeek from 'date-fns-jalali/endOfWeek';
22
12
  import endOfYear from 'date-fns-jalali/endOfYear';
23
13
  import dateFnsFormat from 'date-fns-jalali/format';
24
- import formatISO from 'date-fns-jalali/formatISO';
25
14
  import getHours from 'date-fns-jalali/getHours';
26
15
  import getSeconds from 'date-fns-jalali/getSeconds';
27
16
  import getMilliseconds from 'date-fns-jalali/getMilliseconds';
@@ -40,7 +29,6 @@ import isSameMonth from 'date-fns-jalali/isSameMonth';
40
29
  import isSameHour from 'date-fns-jalali/isSameHour';
41
30
  import isValid from 'date-fns-jalali/isValid';
42
31
  import dateFnsParse from 'date-fns-jalali/parse';
43
- import parseISO from 'date-fns-jalali/parseISO';
44
32
  import setDate from 'date-fns-jalali/setDate';
45
33
  import setHours from 'date-fns-jalali/setHours';
46
34
  import setMinutes from 'date-fns-jalali/setMinutes';
@@ -235,16 +223,10 @@ const defaultFormats = {
235
223
  minutes: 'mm',
236
224
  seconds: 'ss',
237
225
  fullDate: 'PPP',
238
- fullDateWithWeekday: 'PPPP',
239
226
  keyboardDate: 'P',
240
227
  shortDate: 'd MMM',
241
228
  normalDate: 'd MMMM',
242
229
  normalDateWithWeekday: 'EEE, d MMMM',
243
- monthAndYear: 'LLLL yyyy',
244
- monthAndDate: 'd MMMM',
245
- fullDateTime: 'PPP p',
246
- fullDateTime12h: 'PPP hh:mm aa',
247
- fullDateTime24h: 'PPP HH:mm',
248
230
  fullTime: 'p',
249
231
  fullTime12h: 'hh:mm aaa',
250
232
  fullTime24h: 'HH:mm',
@@ -326,14 +308,6 @@ export class AdapterDateFnsJalali {
326
308
  this.toJsDate = value => {
327
309
  return value;
328
310
  };
329
- this.parseISO = isoString => {
330
- return parseISO(isoString);
331
- };
332
- this.toISO = value => {
333
- return formatISO(value, {
334
- format: 'extended'
335
- });
336
- };
337
311
  this.parse = (value, format) => {
338
312
  if (value === '') {
339
313
  return null;
@@ -368,14 +342,11 @@ export class AdapterDateFnsJalali {
368
342
  return token;
369
343
  }).join('');
370
344
  };
371
- this.getFormatHelperText = format => {
372
- return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
373
- };
374
- this.isNull = value => {
375
- return value === null;
376
- };
377
345
  this.isValid = value => {
378
- return isValid(this.date(value));
346
+ if (value == null) {
347
+ return false;
348
+ }
349
+ return isValid(value);
379
350
  };
380
351
  this.format = (value, formatKey) => {
381
352
  return this.formatByString(value, this.formats[formatKey]);
@@ -388,34 +359,13 @@ export class AdapterDateFnsJalali {
388
359
  this.formatNumber = numberToFormat => {
389
360
  return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
390
361
  };
391
- this.getDiff = (value, comparing, unit) => {
392
- switch (unit) {
393
- case 'years':
394
- return differenceInYears(value, this.date(comparing));
395
- case 'quarters':
396
- return differenceInQuarters(value, this.date(comparing));
397
- case 'months':
398
- return differenceInMonths(value, this.date(comparing));
399
- case 'weeks':
400
- return differenceInWeeks(value, this.date(comparing));
401
- case 'days':
402
- return differenceInDays(value, this.date(comparing));
403
- case 'hours':
404
- return differenceInHours(value, this.date(comparing));
405
- case 'minutes':
406
- return differenceInMinutes(value, this.date(comparing));
407
- case 'seconds':
408
- return differenceInSeconds(value, this.date(comparing));
409
- default:
410
- {
411
- return differenceInMilliseconds(value, this.date(comparing));
412
- }
413
- }
414
- };
415
362
  this.isEqual = (value, comparing) => {
416
363
  if (value === null && comparing === null) {
417
364
  return true;
418
365
  }
366
+ if (value === null || comparing === null) {
367
+ return false;
368
+ }
419
369
  return isEqual(value, comparing);
420
370
  };
421
371
  this.isSameYear = (value, comparing) => {
@@ -548,35 +498,6 @@ export class AdapterDateFnsJalali {
548
498
  this.getDaysInMonth = value => {
549
499
  return getDaysInMonth(value);
550
500
  };
551
- this.getNextMonth = value => {
552
- return addMonths(value, 1);
553
- };
554
- this.getPreviousMonth = value => {
555
- return addMonths(value, -1);
556
- };
557
- this.getMonthArray = value => {
558
- const firstMonth = startOfYear(value);
559
- const monthArray = [firstMonth];
560
- while (monthArray.length < 12) {
561
- const prevMonth = monthArray[monthArray.length - 1];
562
- monthArray.push(this.getNextMonth(prevMonth));
563
- }
564
- return monthArray;
565
- };
566
- this.mergeDateAndTime = (dateParam, timeParam) => {
567
- return this.setSeconds(this.setMinutes(this.setHours(dateParam, this.getHours(timeParam)), this.getMinutes(timeParam)), this.getSeconds(timeParam));
568
- };
569
- this.getWeekdays = () => {
570
- const now = new Date();
571
- return eachDayOfInterval({
572
- start: startOfWeek(now, {
573
- locale: this.locale
574
- }),
575
- end: endOfWeek(now, {
576
- locale: this.locale
577
- })
578
- }).map(day => this.formatByString(day, 'EEEEEE'));
579
- };
580
501
  this.getWeekArray = value => {
581
502
  const start = startOfWeek(startOfMonth(value), {
582
503
  locale: this.locale
@@ -601,7 +522,7 @@ export class AdapterDateFnsJalali {
601
522
  locale: this.locale
602
523
  });
603
524
  };
604
- this.getYearRange = (start, end) => {
525
+ this.getYearRange = ([start, end]) => {
605
526
  const startDate = startOfYear(start);
606
527
  const endDate = endOfYear(end);
607
528
  const years = [];
@@ -612,9 +533,6 @@ export class AdapterDateFnsJalali {
612
533
  }
613
534
  return years;
614
535
  };
615
- this.getMeridiemText = ampm => {
616
- return ampm === 'am' ? 'ق.ظ' : 'ب.ظ';
617
- };
618
536
  this.locale = _locale;
619
537
  this.formats = _extends({}, defaultFormats, formats);
620
538
  }
@@ -106,19 +106,13 @@ const defaultFormats = {
106
106
  minutes: 'mm',
107
107
  seconds: 'ss',
108
108
  fullDate: 'll',
109
- fullDateWithWeekday: 'dddd, LL',
110
109
  keyboardDate: 'L',
111
110
  shortDate: 'MMM D',
112
111
  normalDate: 'D MMMM',
113
112
  normalDateWithWeekday: 'ddd, MMM D',
114
- monthAndYear: 'MMMM YYYY',
115
- monthAndDate: 'MMMM D',
116
113
  fullTime: 'LT',
117
114
  fullTime12h: 'hh:mm A',
118
115
  fullTime24h: 'HH:mm',
119
- fullDateTime: 'lll',
120
- fullDateTime12h: 'll hh:mm A',
121
- fullDateTime24h: 'll HH:mm',
122
116
  keyboardDateTime: 'L LT',
123
117
  keyboardDateTime12h: 'L hh:mm A',
124
118
  keyboardDateTime24h: 'L HH:mm'
@@ -155,13 +149,11 @@ const withLocale = (dayjs, locale) => !locale ? dayjs : (...args) => dayjs(...ar
155
149
  export class AdapterDayjs {
156
150
  constructor({
157
151
  locale: _locale,
158
- formats,
159
- instance
152
+ formats
160
153
  } = {}) {
161
154
  this.isMUIAdapter = true;
162
155
  this.isTimezoneCompatible = true;
163
156
  this.lib = 'dayjs';
164
- this.rawDayJsInstance = void 0;
165
157
  this.dayjs = void 0;
166
158
  this.locale = void 0;
167
159
  this.formats = void 0;
@@ -203,11 +195,6 @@ export class AdapterDayjs {
203
195
  }
204
196
  };
205
197
  this.createSystemDate = value => {
206
- // TODO v7: Stop using `this.rawDayJsInstance` (drop the `instance` param on the adapters)
207
- /* istanbul ignore next */
208
- if (this.rawDayJsInstance) {
209
- return this.rawDayJsInstance(value);
210
- }
211
198
  if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
212
199
  const timezone = defaultDayjs.tz.guess();
213
200
 
@@ -338,12 +325,6 @@ export class AdapterDayjs {
338
325
  this.toJsDate = value => {
339
326
  return value.toDate();
340
327
  };
341
- this.parseISO = isoString => {
342
- return this.dayjs(isoString);
343
- };
344
- this.toISO = value => {
345
- return value.toISOString();
346
- };
347
328
  this.parse = (value, format) => {
348
329
  if (value === '') {
349
330
  return null;
@@ -367,14 +348,11 @@ export class AdapterDayjs {
367
348
  return a || localeFormats[b] || t(localeFormats[B]);
368
349
  });
369
350
  };
370
- this.getFormatHelperText = format => {
371
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
372
- };
373
- this.isNull = value => {
374
- return value === null;
375
- };
376
351
  this.isValid = value => {
377
- return this.dayjs(value).isValid();
352
+ if (value == null) {
353
+ return false;
354
+ }
355
+ return value.isValid();
378
356
  };
379
357
  this.format = (value, formatKey) => {
380
358
  return this.formatByString(value, this.formats[formatKey]);
@@ -385,14 +363,14 @@ export class AdapterDayjs {
385
363
  this.formatNumber = numberToFormat => {
386
364
  return numberToFormat;
387
365
  };
388
- this.getDiff = (value, comparing, unit) => {
389
- return value.diff(comparing, unit);
390
- };
391
366
  this.isEqual = (value, comparing) => {
392
367
  if (value === null && comparing === null) {
393
368
  return true;
394
369
  }
395
- return this.dayjs(value).toDate().getTime() === this.dayjs(comparing).toDate().getTime();
370
+ if (value === null || comparing === null) {
371
+ return false;
372
+ }
373
+ return value.toDate().getTime() === comparing.toDate().getTime();
396
374
  };
397
375
  this.isSameYear = (value, comparing) => {
398
376
  return this.isSame(value, comparing, 'YYYY');
@@ -529,28 +507,6 @@ export class AdapterDayjs {
529
507
  this.getDaysInMonth = value => {
530
508
  return value.daysInMonth();
531
509
  };
532
- this.getNextMonth = value => {
533
- return this.addMonths(value, 1);
534
- };
535
- this.getPreviousMonth = value => {
536
- return this.addMonths(value, -1);
537
- };
538
- this.getMonthArray = value => {
539
- const firstMonth = value.startOf('year');
540
- const monthArray = [firstMonth];
541
- while (monthArray.length < 12) {
542
- const prevMonth = monthArray[monthArray.length - 1];
543
- monthArray.push(this.addMonths(prevMonth, 1));
544
- }
545
- return monthArray;
546
- };
547
- this.mergeDateAndTime = (dateParam, timeParam) => {
548
- return dateParam.hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
549
- };
550
- this.getWeekdays = () => {
551
- const start = this.dayjs().startOf('week');
552
- return [0, 1, 2, 3, 4, 5, 6].map(diff => this.formatByString(this.addDays(start, diff), 'dd'));
553
- };
554
510
  this.getWeekArray = value => {
555
511
  const cleanValue = this.setLocaleToValue(value);
556
512
  const start = cleanValue.startOf('month').startOf('week');
@@ -570,7 +526,7 @@ export class AdapterDayjs {
570
526
  this.getWeekNumber = value => {
571
527
  return value.week();
572
528
  };
573
- this.getYearRange = (start, end) => {
529
+ this.getYearRange = ([start, end]) => {
574
530
  const startDate = start.startOf('year');
575
531
  const endDate = end.endOf('year');
576
532
  const years = [];
@@ -581,11 +537,7 @@ export class AdapterDayjs {
581
537
  }
582
538
  return years;
583
539
  };
584
- this.getMeridiemText = ampm => {
585
- return ampm === 'am' ? 'AM' : 'PM';
586
- };
587
- this.rawDayJsInstance = instance;
588
- this.dayjs = withLocale(this.rawDayJsInstance ?? defaultDayjs, _locale);
540
+ this.dayjs = withLocale(defaultDayjs, _locale);
589
541
  this.locale = _locale;
590
542
  this.formats = _extends({}, defaultFormats, formats);
591
543
  defaultDayjs.extend(weekOfYear);
@@ -120,19 +120,13 @@ const defaultFormats = {
120
120
  minutes: 'mm',
121
121
  seconds: 'ss',
122
122
  fullDate: 'DD',
123
- fullDateWithWeekday: 'DDDD',
124
123
  keyboardDate: 'D',
125
124
  shortDate: 'MMM d',
126
125
  normalDate: 'd MMMM',
127
126
  normalDateWithWeekday: 'EEE, MMM d',
128
- monthAndYear: 'LLLL yyyy',
129
- monthAndDate: 'MMMM d',
130
127
  fullTime: 't',
131
128
  fullTime12h: 'hh:mm a',
132
129
  fullTime24h: 'HH:mm',
133
- fullDateTime: 'ff',
134
- fullDateTime12h: 'DD, hh:mm a',
135
- fullDateTime24h: 'DD, T',
136
130
  keyboardDateTime: 'D t',
137
131
  keyboardDateTime12h: 'D hh:mm a',
138
132
  keyboardDateTime24h: 'D T'
@@ -241,14 +235,6 @@ export class AdapterLuxon {
241
235
  this.toJsDate = value => {
242
236
  return value.toJSDate();
243
237
  };
244
- this.parseISO = isoString => {
245
- return DateTime.fromISO(isoString);
246
- };
247
- this.toISO = value => {
248
- return value.toUTC().toISO({
249
- format: 'extended'
250
- });
251
- };
252
238
  this.parse = (value, formatString) => {
253
239
  if (value === '') {
254
240
  return null;
@@ -297,20 +283,11 @@ export class AdapterLuxon {
297
283
  // To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
298
284
  .replace('yyyyy', 'yyyy');
299
285
  };
300
- this.getFormatHelperText = format => {
301
- return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
302
- };
303
- this.isNull = value => {
304
- return value === null;
305
- };
306
286
  this.isValid = value => {
307
- if (DateTime.isDateTime(value)) {
308
- return value.isValid;
309
- }
310
287
  if (value === null) {
311
288
  return false;
312
289
  }
313
- return this.isValid(this.date(value));
290
+ return value.isValid;
314
291
  };
315
292
  this.format = (value, formatKey) => {
316
293
  return this.formatByString(value, this.formats[formatKey]);
@@ -321,25 +298,14 @@ export class AdapterLuxon {
321
298
  this.formatNumber = numberToFormat => {
322
299
  return numberToFormat;
323
300
  };
324
- this.getDiff = (value, comparing, unit) => {
325
- if (typeof comparing === 'string') {
326
- comparing = DateTime.fromJSDate(new Date(comparing));
327
- }
328
- if (unit) {
329
- return Math.floor(value.diff(comparing).as(unit));
330
- }
331
- return value.diff(comparing).as('millisecond');
332
- };
333
301
  this.isEqual = (value, comparing) => {
334
302
  if (value === null && comparing === null) {
335
303
  return true;
336
304
  }
337
-
338
- // Make sure that null will not be passed to this.date
339
305
  if (value === null || comparing === null) {
340
306
  return false;
341
307
  }
342
- return +this.date(value) === +this.date(comparing);
308
+ return +value === +comparing;
343
309
  };
344
310
  this.isSameYear = (value, comparing) => {
345
311
  const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
@@ -505,37 +471,6 @@ export class AdapterLuxon {
505
471
  this.getDaysInMonth = value => {
506
472
  return value.daysInMonth;
507
473
  };
508
- this.getNextMonth = value => {
509
- return value.plus({
510
- months: 1
511
- });
512
- };
513
- this.getPreviousMonth = value => {
514
- return value.minus({
515
- months: 1
516
- });
517
- };
518
- this.getMonthArray = value => {
519
- const firstMonth = value.startOf('year');
520
- const monthArray = [firstMonth];
521
- while (monthArray.length < 12) {
522
- const prevMonth = monthArray[monthArray.length - 1];
523
- monthArray.push(this.addMonths(prevMonth, 1));
524
- }
525
- return monthArray;
526
- };
527
- this.mergeDateAndTime = (dateParam, timeParam) => {
528
- return dateParam.set({
529
- second: timeParam.second,
530
- hour: timeParam.hour,
531
- minute: timeParam.minute
532
- });
533
- };
534
- this.getWeekdays = () => {
535
- return Info.weekdaysFormat('narrow', {
536
- locale: this.locale
537
- });
538
- };
539
474
  this.getWeekArray = value => {
540
475
  const cleanValue = this.setLocaleToValue(value);
541
476
  const {
@@ -556,7 +491,7 @@ export class AdapterLuxon {
556
491
  this.getWeekNumber = value => {
557
492
  return value.weekNumber;
558
493
  };
559
- this.getYearRange = (start, end) => {
494
+ this.getYearRange = ([start, end]) => {
560
495
  const startDate = start.startOf('year');
561
496
  const endDate = end.endOf('year');
562
497
  let current = startDate;
@@ -569,11 +504,6 @@ export class AdapterLuxon {
569
504
  }
570
505
  return years;
571
506
  };
572
- this.getMeridiemText = ampm => {
573
- return Info.meridiems({
574
- locale: this.locale
575
- }).find(v => v.toLowerCase() === ampm.toLowerCase());
576
- };
577
507
  this.locale = locale || 'en-US';
578
508
  this.formats = _extends({}, defaultFormats, formats);
579
509
  }