@mui/x-date-pickers 6.18.1 → 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.
- package/AdapterDateFns/AdapterDateFns.d.ts +4 -15
- package/AdapterDateFns/AdapterDateFns.js +8 -90
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +4 -15
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/AdapterDayjs/AdapterDayjs.d.ts +5 -17
- package/AdapterDayjs/AdapterDayjs.js +11 -60
- package/AdapterLuxon/AdapterLuxon.d.ts +4 -15
- package/AdapterLuxon/AdapterLuxon.js +16 -76
- package/AdapterMoment/AdapterMoment.d.ts +4 -20
- package/AdapterMoment/AdapterMoment.js +9 -66
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +1 -7
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +1 -9
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/CHANGELOG.md +558 -1
- package/DateCalendar/DateCalendar.js +4 -21
- package/DateCalendar/DateCalendar.types.d.ts +12 -3
- package/DateCalendar/DayCalendar.d.ts +13 -5
- package/DateCalendar/DayCalendar.js +12 -21
- package/DateCalendar/index.d.ts +0 -1
- package/DateCalendar/index.js +1 -3
- package/DateCalendar/useCalendarState.js +2 -3
- package/DateField/DateField.js +5 -21
- package/DateField/DateField.types.d.ts +12 -3
- package/DatePicker/DatePicker.js +0 -13
- package/DatePicker/DatePicker.types.d.ts +1 -14
- package/DatePicker/shared.d.ts +4 -16
- package/DatePicker/shared.js +2 -5
- package/DateTimeField/DateTimeField.js +5 -21
- package/DateTimeField/DateTimeField.types.d.ts +2 -15
- package/DateTimePicker/DateTimePicker.js +0 -13
- package/DateTimePicker/DateTimePicker.types.d.ts +1 -14
- package/DateTimePicker/shared.d.ts +4 -17
- package/DateTimePicker/shared.js +4 -7
- package/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +2 -15
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +2 -15
- package/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -15
- package/DigitalClock/DigitalClock.js +18 -26
- package/DigitalClock/DigitalClock.types.d.ts +2 -15
- package/LocalizationProvider/LocalizationProvider.js +0 -6
- package/MobileDatePicker/MobileDatePicker.js +0 -13
- package/MobileDatePicker/MobileDatePicker.types.d.ts +2 -15
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +2 -15
- package/MobileTimePicker/MobileTimePicker.js +0 -12
- package/MobileTimePicker/MobileTimePicker.types.d.ts +2 -15
- package/MonthCalendar/MonthCalendar.js +3 -7
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -18
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +3 -15
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +2 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -10
- package/PickersCalendarHeader/PickersCalendarHeader.js +14 -20
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -16
- package/PickersLayout/PickersLayout.js +0 -12
- package/PickersLayout/PickersLayout.types.d.ts +6 -19
- package/PickersLayout/usePickerLayout.js +2 -7
- package/StaticDatePicker/StaticDatePicker.js +0 -13
- package/StaticDatePicker/StaticDatePicker.types.d.ts +2 -14
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +2 -14
- package/StaticTimePicker/StaticTimePicker.js +0 -12
- package/StaticTimePicker/StaticTimePicker.types.d.ts +2 -14
- package/TimeClock/TimeClock.js +3 -20
- package/TimeClock/TimeClock.types.d.ts +1 -14
- package/TimeField/TimeField.js +5 -21
- package/TimeField/TimeField.types.d.ts +2 -15
- package/TimePicker/TimePicker.js +0 -12
- package/TimePicker/TimePicker.types.d.ts +1 -14
- package/TimePicker/shared.d.ts +3 -16
- package/TimePicker/shared.js +4 -7
- package/YearCalendar/YearCalendar.js +4 -8
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +2 -8
- package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.js +0 -4
- package/hooks/useClearableField.d.ts +1 -3
- package/hooks/useClearableField.js +6 -8
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +10 -6
- package/internals/components/PickersModalDialog.d.ts +4 -5
- package/internals/components/PickersPopper.d.ts +5 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -8
- package/internals/hooks/useField/useField.types.d.ts +2 -2
- package/internals/hooks/useField/useField.utils.js +0 -1
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +3 -4
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +1 -14
- package/internals/index.d.ts +0 -2
- package/internals/index.js +0 -1
- package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
- package/internals/utils/getDefaultReferenceDate.js +0 -4
- package/legacy/AdapterDateFns/AdapterDateFns.js +11 -92
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +11 -92
- package/legacy/AdapterDayjs/AdapterDayjs.js +15 -63
- package/legacy/AdapterLuxon/AdapterLuxon.js +19 -78
- package/legacy/AdapterMoment/AdapterMoment.js +12 -70
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -30
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -40
- package/legacy/DateCalendar/DateCalendar.js +4 -21
- package/legacy/DateCalendar/DayCalendar.js +10 -16
- package/legacy/DateCalendar/index.js +1 -3
- package/legacy/DateCalendar/useCalendarState.js +2 -3
- package/legacy/DateField/DateField.js +6 -22
- package/legacy/DatePicker/DatePicker.js +0 -13
- package/legacy/DatePicker/shared.js +2 -5
- package/legacy/DateTimeField/DateTimeField.js +6 -22
- package/legacy/DateTimePicker/DateTimePicker.js +0 -13
- package/legacy/DateTimePicker/shared.js +4 -7
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/legacy/DigitalClock/DigitalClock.js +20 -26
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -13
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -12
- package/legacy/MonthCalendar/MonthCalendar.js +3 -6
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +11 -18
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +15 -10
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +14 -20
- package/legacy/PickersLayout/PickersLayout.js +0 -12
- package/legacy/PickersLayout/usePickerLayout.js +2 -7
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -13
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -12
- package/legacy/TimeClock/TimeClock.js +3 -20
- package/legacy/TimeField/TimeField.js +5 -21
- package/legacy/TimePicker/TimePicker.js +0 -12
- package/legacy/TimePicker/shared.js +4 -7
- package/legacy/YearCalendar/YearCalendar.js +4 -7
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +2 -8
- package/legacy/dateViewRenderers/dateViewRenderers.js +0 -4
- package/legacy/hooks/useClearableField.js +6 -8
- package/legacy/index.js +4 -1
- package/legacy/internals/hooks/useField/useField.utils.js +0 -1
- package/legacy/internals/hooks/useField/useFieldState.js +1 -1
- package/legacy/internals/index.js +0 -1
- package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
- package/legacy/locales/esES.js +6 -7
- package/legacy/locales/eu.js +94 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/timeViewRenderers/timeViewRenderers.js +0 -12
- package/locales/esES.js +6 -7
- package/locales/eu.d.ts +54 -0
- package/locales/eu.js +58 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/models/adapters.d.ts +10 -135
- package/models/fields.d.ts +0 -6
- package/modern/AdapterDateFns/AdapterDateFns.js +8 -90
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/modern/AdapterDayjs/AdapterDayjs.js +11 -59
- package/modern/AdapterLuxon/AdapterLuxon.js +16 -76
- package/modern/AdapterMoment/AdapterMoment.js +9 -65
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/modern/DateCalendar/DateCalendar.js +3 -20
- package/modern/DateCalendar/DayCalendar.js +11 -19
- package/modern/DateCalendar/index.js +1 -3
- package/modern/DateCalendar/useCalendarState.js +2 -3
- package/modern/DateField/DateField.js +4 -20
- package/modern/DatePicker/DatePicker.js +0 -13
- package/modern/DatePicker/shared.js +1 -4
- package/modern/DateTimeField/DateTimeField.js +4 -20
- package/modern/DateTimePicker/DateTimePicker.js +0 -13
- package/modern/DateTimePicker/shared.js +3 -6
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/modern/DigitalClock/DigitalClock.js +17 -25
- package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -13
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -12
- package/modern/MonthCalendar/MonthCalendar.js +3 -7
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -18
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -10
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +13 -19
- package/modern/PickersLayout/PickersLayout.js +0 -12
- package/modern/PickersLayout/usePickerLayout.js +2 -7
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -13
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- package/modern/StaticTimePicker/StaticTimePicker.js +0 -12
- package/modern/TimeClock/TimeClock.js +3 -20
- package/modern/TimeField/TimeField.js +4 -20
- package/modern/TimePicker/TimePicker.js +0 -12
- package/modern/TimePicker/shared.js +3 -6
- package/modern/YearCalendar/YearCalendar.js +4 -8
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +1 -7
- package/modern/dateViewRenderers/dateViewRenderers.js +0 -4
- package/modern/hooks/useClearableField.js +5 -7
- package/modern/index.js +4 -1
- package/modern/internals/hooks/useField/useField.utils.js +0 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/index.js +0 -1
- package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
- package/modern/locales/esES.js +6 -7
- package/modern/locales/eu.js +58 -0
- package/modern/locales/index.js +1 -0
- package/modern/timeViewRenderers/timeViewRenderers.js +0 -12
- package/node/AdapterDateFns/AdapterDateFns.js +8 -90
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/node/AdapterDayjs/AdapterDayjs.js +11 -59
- package/node/AdapterLuxon/AdapterLuxon.js +16 -76
- package/node/AdapterMoment/AdapterMoment.js +9 -65
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/node/DateCalendar/DateCalendar.js +3 -20
- package/node/DateCalendar/DayCalendar.js +11 -19
- package/node/DateCalendar/index.js +1 -21
- package/node/DateCalendar/useCalendarState.js +1 -2
- package/node/DateField/DateField.js +4 -20
- package/node/DatePicker/DatePicker.js +0 -13
- package/node/DatePicker/shared.js +1 -4
- package/node/DateTimeField/DateTimeField.js +4 -20
- package/node/DateTimePicker/DateTimePicker.js +0 -13
- package/node/DateTimePicker/shared.js +3 -6
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -13
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -13
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -12
- package/node/DigitalClock/DigitalClock.js +17 -25
- package/node/LocalizationProvider/LocalizationProvider.js +0 -6
- package/node/MobileDatePicker/MobileDatePicker.js +0 -13
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -13
- package/node/MobileTimePicker/MobileTimePicker.js +0 -12
- package/node/MonthCalendar/MonthCalendar.js +3 -7
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -18
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +16 -6
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -10
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +13 -19
- package/node/PickersLayout/PickersLayout.js +0 -12
- package/node/PickersLayout/usePickerLayout.js +2 -7
- package/node/StaticDatePicker/StaticDatePicker.js +0 -13
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -13
- package/node/StaticTimePicker/StaticTimePicker.js +0 -12
- package/node/TimeClock/TimeClock.js +3 -20
- package/node/TimeField/TimeField.js +4 -20
- package/node/TimePicker/TimePicker.js +0 -12
- package/node/TimePicker/shared.js +3 -6
- package/node/YearCalendar/YearCalendar.js +4 -8
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +1 -7
- package/node/dateViewRenderers/dateViewRenderers.js +0 -4
- package/node/hooks/useClearableField.js +5 -7
- package/node/index.js +13 -1
- package/node/internals/hooks/useField/useField.utils.js +0 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/index.js +0 -7
- package/node/internals/utils/getDefaultReferenceDate.js +1 -3
- package/node/locales/esES.js +6 -7
- package/node/locales/eu.js +64 -0
- package/node/locales/index.js +11 -0
- package/node/timeViewRenderers/timeViewRenderers.js +0 -12
- package/package.json +1 -1
- package/themeAugmentation/overrides.d.ts +1 -1
- package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
- package/timeViewRenderers/timeViewRenderers.js +0 -12
- package/internals/utils/slots-migration.d.ts +0 -36
- package/internals/utils/slots-migration.js +0 -13
- package/legacy/internals/utils/slots-migration.js +0 -14
- package/modern/internals/utils/slots-migration.js +0 -13
- package/node/internals/utils/slots-migration.js +0 -21
|
@@ -114,19 +114,13 @@ const defaultFormats = {
|
|
|
114
114
|
minutes: 'mm',
|
|
115
115
|
seconds: 'ss',
|
|
116
116
|
fullDate: 'll',
|
|
117
|
-
fullDateWithWeekday: 'dddd, LL',
|
|
118
117
|
keyboardDate: 'L',
|
|
119
118
|
shortDate: 'MMM D',
|
|
120
119
|
normalDate: 'D MMMM',
|
|
121
120
|
normalDateWithWeekday: 'ddd, MMM D',
|
|
122
|
-
monthAndYear: 'MMMM YYYY',
|
|
123
|
-
monthAndDate: 'MMMM D',
|
|
124
121
|
fullTime: 'LT',
|
|
125
122
|
fullTime12h: 'hh:mm A',
|
|
126
123
|
fullTime24h: 'HH:mm',
|
|
127
|
-
fullDateTime: 'lll',
|
|
128
|
-
fullDateTime12h: 'll hh:mm A',
|
|
129
|
-
fullDateTime24h: 'll HH:mm',
|
|
130
124
|
keyboardDateTime: 'L LT',
|
|
131
125
|
keyboardDateTime12h: 'L hh:mm A',
|
|
132
126
|
keyboardDateTime24h: 'L HH:mm'
|
|
@@ -163,13 +157,11 @@ const withLocale = (dayjs, locale) => !locale ? dayjs : (...args) => dayjs(...ar
|
|
|
163
157
|
class AdapterDayjs {
|
|
164
158
|
constructor({
|
|
165
159
|
locale: _locale,
|
|
166
|
-
formats
|
|
167
|
-
instance
|
|
160
|
+
formats
|
|
168
161
|
} = {}) {
|
|
169
162
|
this.isMUIAdapter = true;
|
|
170
163
|
this.isTimezoneCompatible = true;
|
|
171
164
|
this.lib = 'dayjs';
|
|
172
|
-
this.rawDayJsInstance = void 0;
|
|
173
165
|
this.dayjs = void 0;
|
|
174
166
|
this.locale = void 0;
|
|
175
167
|
this.formats = void 0;
|
|
@@ -211,11 +203,6 @@ class AdapterDayjs {
|
|
|
211
203
|
}
|
|
212
204
|
};
|
|
213
205
|
this.createSystemDate = value => {
|
|
214
|
-
// TODO v7: Stop using `this.rawDayJsInstance` (drop the `instance` param on the adapters)
|
|
215
|
-
/* istanbul ignore next */
|
|
216
|
-
if (this.rawDayJsInstance) {
|
|
217
|
-
return this.rawDayJsInstance(value);
|
|
218
|
-
}
|
|
219
206
|
if (this.hasUTCPlugin() && this.hasTimezonePlugin()) {
|
|
220
207
|
const timezone = _dayjs.default.tz.guess();
|
|
221
208
|
|
|
@@ -346,12 +333,6 @@ class AdapterDayjs {
|
|
|
346
333
|
this.toJsDate = value => {
|
|
347
334
|
return value.toDate();
|
|
348
335
|
};
|
|
349
|
-
this.parseISO = isoString => {
|
|
350
|
-
return this.dayjs(isoString);
|
|
351
|
-
};
|
|
352
|
-
this.toISO = value => {
|
|
353
|
-
return value.toISOString();
|
|
354
|
-
};
|
|
355
336
|
this.parse = (value, format) => {
|
|
356
337
|
if (value === '') {
|
|
357
338
|
return null;
|
|
@@ -375,14 +356,11 @@ class AdapterDayjs {
|
|
|
375
356
|
return a || localeFormats[b] || t(localeFormats[B]);
|
|
376
357
|
});
|
|
377
358
|
};
|
|
378
|
-
this.getFormatHelperText = format => {
|
|
379
|
-
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
380
|
-
};
|
|
381
|
-
this.isNull = value => {
|
|
382
|
-
return value === null;
|
|
383
|
-
};
|
|
384
359
|
this.isValid = value => {
|
|
385
|
-
|
|
360
|
+
if (value == null) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
return value.isValid();
|
|
386
364
|
};
|
|
387
365
|
this.format = (value, formatKey) => {
|
|
388
366
|
return this.formatByString(value, this.formats[formatKey]);
|
|
@@ -393,14 +371,14 @@ class AdapterDayjs {
|
|
|
393
371
|
this.formatNumber = numberToFormat => {
|
|
394
372
|
return numberToFormat;
|
|
395
373
|
};
|
|
396
|
-
this.getDiff = (value, comparing, unit) => {
|
|
397
|
-
return value.diff(comparing, unit);
|
|
398
|
-
};
|
|
399
374
|
this.isEqual = (value, comparing) => {
|
|
400
375
|
if (value === null && comparing === null) {
|
|
401
376
|
return true;
|
|
402
377
|
}
|
|
403
|
-
|
|
378
|
+
if (value === null || comparing === null) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
return value.toDate().getTime() === comparing.toDate().getTime();
|
|
404
382
|
};
|
|
405
383
|
this.isSameYear = (value, comparing) => {
|
|
406
384
|
return this.isSame(value, comparing, 'YYYY');
|
|
@@ -537,28 +515,6 @@ class AdapterDayjs {
|
|
|
537
515
|
this.getDaysInMonth = value => {
|
|
538
516
|
return value.daysInMonth();
|
|
539
517
|
};
|
|
540
|
-
this.getNextMonth = value => {
|
|
541
|
-
return this.addMonths(value, 1);
|
|
542
|
-
};
|
|
543
|
-
this.getPreviousMonth = value => {
|
|
544
|
-
return this.addMonths(value, -1);
|
|
545
|
-
};
|
|
546
|
-
this.getMonthArray = value => {
|
|
547
|
-
const firstMonth = value.startOf('year');
|
|
548
|
-
const monthArray = [firstMonth];
|
|
549
|
-
while (monthArray.length < 12) {
|
|
550
|
-
const prevMonth = monthArray[monthArray.length - 1];
|
|
551
|
-
monthArray.push(this.addMonths(prevMonth, 1));
|
|
552
|
-
}
|
|
553
|
-
return monthArray;
|
|
554
|
-
};
|
|
555
|
-
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
556
|
-
return dateParam.hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
|
|
557
|
-
};
|
|
558
|
-
this.getWeekdays = () => {
|
|
559
|
-
const start = this.dayjs().startOf('week');
|
|
560
|
-
return [0, 1, 2, 3, 4, 5, 6].map(diff => this.formatByString(this.addDays(start, diff), 'dd'));
|
|
561
|
-
};
|
|
562
518
|
this.getWeekArray = value => {
|
|
563
519
|
const cleanValue = this.setLocaleToValue(value);
|
|
564
520
|
const start = cleanValue.startOf('month').startOf('week');
|
|
@@ -578,7 +534,7 @@ class AdapterDayjs {
|
|
|
578
534
|
this.getWeekNumber = value => {
|
|
579
535
|
return value.week();
|
|
580
536
|
};
|
|
581
|
-
this.getYearRange = (start, end) => {
|
|
537
|
+
this.getYearRange = ([start, end]) => {
|
|
582
538
|
const startDate = start.startOf('year');
|
|
583
539
|
const endDate = end.endOf('year');
|
|
584
540
|
const years = [];
|
|
@@ -589,11 +545,7 @@ class AdapterDayjs {
|
|
|
589
545
|
}
|
|
590
546
|
return years;
|
|
591
547
|
};
|
|
592
|
-
this.
|
|
593
|
-
return ampm === 'am' ? 'AM' : 'PM';
|
|
594
|
-
};
|
|
595
|
-
this.rawDayJsInstance = instance;
|
|
596
|
-
this.dayjs = withLocale(this.rawDayJsInstance ?? _dayjs.default, _locale);
|
|
548
|
+
this.dayjs = withLocale(_dayjs.default, _locale);
|
|
597
549
|
this.locale = _locale;
|
|
598
550
|
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
599
551
|
_dayjs.default.extend(_weekOfYear.default);
|
|
@@ -128,19 +128,13 @@ const defaultFormats = {
|
|
|
128
128
|
minutes: 'mm',
|
|
129
129
|
seconds: 'ss',
|
|
130
130
|
fullDate: 'DD',
|
|
131
|
-
fullDateWithWeekday: 'DDDD',
|
|
132
131
|
keyboardDate: 'D',
|
|
133
132
|
shortDate: 'MMM d',
|
|
134
133
|
normalDate: 'd MMMM',
|
|
135
134
|
normalDateWithWeekday: 'EEE, MMM d',
|
|
136
|
-
monthAndYear: 'LLLL yyyy',
|
|
137
|
-
monthAndDate: 'MMMM d',
|
|
138
135
|
fullTime: 't',
|
|
139
136
|
fullTime12h: 'hh:mm a',
|
|
140
137
|
fullTime24h: 'HH:mm',
|
|
141
|
-
fullDateTime: 'ff',
|
|
142
|
-
fullDateTime12h: 'DD, hh:mm a',
|
|
143
|
-
fullDateTime24h: 'DD, T',
|
|
144
138
|
keyboardDateTime: 'D t',
|
|
145
139
|
keyboardDateTime12h: 'D hh:mm a',
|
|
146
140
|
keyboardDateTime24h: 'D T'
|
|
@@ -249,14 +243,6 @@ class AdapterLuxon {
|
|
|
249
243
|
this.toJsDate = value => {
|
|
250
244
|
return value.toJSDate();
|
|
251
245
|
};
|
|
252
|
-
this.parseISO = isoString => {
|
|
253
|
-
return _luxon.DateTime.fromISO(isoString);
|
|
254
|
-
};
|
|
255
|
-
this.toISO = value => {
|
|
256
|
-
return value.toUTC().toISO({
|
|
257
|
-
format: 'extended'
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
246
|
this.parse = (value, formatString) => {
|
|
261
247
|
if (value === '') {
|
|
262
248
|
return null;
|
|
@@ -280,35 +266,36 @@ class AdapterLuxon {
|
|
|
280
266
|
};
|
|
281
267
|
this.expandFormat = format => {
|
|
282
268
|
// Extract escaped section to avoid extending them
|
|
283
|
-
const
|
|
284
|
-
|
|
269
|
+
const catchEscapedSectionsRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
270
|
+
|
|
271
|
+
// Extract words to test if they are a token or a word to escape.
|
|
272
|
+
const catchWordsRegexp = /(?:^|[^a-z])([a-z]+)(?:[^a-z]|$)|([a-z]+)/gi;
|
|
273
|
+
return format.match(catchEscapedSectionsRegexp).map(token => {
|
|
285
274
|
const firstCharacter = token[0];
|
|
286
275
|
if (firstCharacter === "'") {
|
|
287
276
|
return token;
|
|
288
277
|
}
|
|
289
|
-
|
|
278
|
+
const expandedToken = _luxon.DateTime.expandFormat(token, {
|
|
290
279
|
locale: this.locale
|
|
291
280
|
});
|
|
281
|
+
return expandedToken.replace(catchWordsRegexp, (correspondance, g1, g2) => {
|
|
282
|
+
const word = g1 || g2; // words are either in group 1 or group 2
|
|
283
|
+
if (word === 'yyyyy' || formatTokenMap[word] !== undefined) {
|
|
284
|
+
return correspondance;
|
|
285
|
+
}
|
|
286
|
+
return `'${correspondance}'`;
|
|
287
|
+
});
|
|
292
288
|
}).join('')
|
|
293
289
|
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
|
294
290
|
// This value is supported by luxon parser but not luxon formatter.
|
|
295
291
|
// To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
|
|
296
292
|
.replace('yyyyy', 'yyyy');
|
|
297
293
|
};
|
|
298
|
-
this.getFormatHelperText = format => {
|
|
299
|
-
return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
300
|
-
};
|
|
301
|
-
this.isNull = value => {
|
|
302
|
-
return value === null;
|
|
303
|
-
};
|
|
304
294
|
this.isValid = value => {
|
|
305
|
-
if (_luxon.DateTime.isDateTime(value)) {
|
|
306
|
-
return value.isValid;
|
|
307
|
-
}
|
|
308
295
|
if (value === null) {
|
|
309
296
|
return false;
|
|
310
297
|
}
|
|
311
|
-
return
|
|
298
|
+
return value.isValid;
|
|
312
299
|
};
|
|
313
300
|
this.format = (value, formatKey) => {
|
|
314
301
|
return this.formatByString(value, this.formats[formatKey]);
|
|
@@ -319,25 +306,14 @@ class AdapterLuxon {
|
|
|
319
306
|
this.formatNumber = numberToFormat => {
|
|
320
307
|
return numberToFormat;
|
|
321
308
|
};
|
|
322
|
-
this.getDiff = (value, comparing, unit) => {
|
|
323
|
-
if (typeof comparing === 'string') {
|
|
324
|
-
comparing = _luxon.DateTime.fromJSDate(new Date(comparing));
|
|
325
|
-
}
|
|
326
|
-
if (unit) {
|
|
327
|
-
return Math.floor(value.diff(comparing).as(unit));
|
|
328
|
-
}
|
|
329
|
-
return value.diff(comparing).as('millisecond');
|
|
330
|
-
};
|
|
331
309
|
this.isEqual = (value, comparing) => {
|
|
332
310
|
if (value === null && comparing === null) {
|
|
333
311
|
return true;
|
|
334
312
|
}
|
|
335
|
-
|
|
336
|
-
// Make sure that null will not be passed to this.date
|
|
337
313
|
if (value === null || comparing === null) {
|
|
338
314
|
return false;
|
|
339
315
|
}
|
|
340
|
-
return +
|
|
316
|
+
return +value === +comparing;
|
|
341
317
|
};
|
|
342
318
|
this.isSameYear = (value, comparing) => {
|
|
343
319
|
const comparingInValueTimezone = this.setTimezone(comparing, this.getTimezone(value));
|
|
@@ -503,37 +479,6 @@ class AdapterLuxon {
|
|
|
503
479
|
this.getDaysInMonth = value => {
|
|
504
480
|
return value.daysInMonth;
|
|
505
481
|
};
|
|
506
|
-
this.getNextMonth = value => {
|
|
507
|
-
return value.plus({
|
|
508
|
-
months: 1
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
|
-
this.getPreviousMonth = value => {
|
|
512
|
-
return value.minus({
|
|
513
|
-
months: 1
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
this.getMonthArray = value => {
|
|
517
|
-
const firstMonth = value.startOf('year');
|
|
518
|
-
const monthArray = [firstMonth];
|
|
519
|
-
while (monthArray.length < 12) {
|
|
520
|
-
const prevMonth = monthArray[monthArray.length - 1];
|
|
521
|
-
monthArray.push(this.addMonths(prevMonth, 1));
|
|
522
|
-
}
|
|
523
|
-
return monthArray;
|
|
524
|
-
};
|
|
525
|
-
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
526
|
-
return dateParam.set({
|
|
527
|
-
second: timeParam.second,
|
|
528
|
-
hour: timeParam.hour,
|
|
529
|
-
minute: timeParam.minute
|
|
530
|
-
});
|
|
531
|
-
};
|
|
532
|
-
this.getWeekdays = () => {
|
|
533
|
-
return _luxon.Info.weekdaysFormat('narrow', {
|
|
534
|
-
locale: this.locale
|
|
535
|
-
});
|
|
536
|
-
};
|
|
537
482
|
this.getWeekArray = value => {
|
|
538
483
|
const cleanValue = this.setLocaleToValue(value);
|
|
539
484
|
const {
|
|
@@ -554,7 +499,7 @@ class AdapterLuxon {
|
|
|
554
499
|
this.getWeekNumber = value => {
|
|
555
500
|
return value.weekNumber;
|
|
556
501
|
};
|
|
557
|
-
this.getYearRange = (start, end) => {
|
|
502
|
+
this.getYearRange = ([start, end]) => {
|
|
558
503
|
const startDate = start.startOf('year');
|
|
559
504
|
const endDate = end.endOf('year');
|
|
560
505
|
let current = startDate;
|
|
@@ -567,11 +512,6 @@ class AdapterLuxon {
|
|
|
567
512
|
}
|
|
568
513
|
return years;
|
|
569
514
|
};
|
|
570
|
-
this.getMeridiemText = ampm => {
|
|
571
|
-
return _luxon.Info.meridiems({
|
|
572
|
-
locale: this.locale
|
|
573
|
-
}).find(v => v.toLowerCase() === ampm.toLowerCase());
|
|
574
|
-
};
|
|
575
515
|
this.locale = locale || 'en-US';
|
|
576
516
|
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
577
517
|
}
|
|
@@ -117,19 +117,13 @@ const defaultFormats = {
|
|
|
117
117
|
minutes: 'mm',
|
|
118
118
|
seconds: 'ss',
|
|
119
119
|
fullDate: 'll',
|
|
120
|
-
fullDateWithWeekday: 'dddd, LL',
|
|
121
120
|
keyboardDate: 'L',
|
|
122
121
|
shortDate: 'MMM D',
|
|
123
122
|
normalDate: 'D MMMM',
|
|
124
123
|
normalDateWithWeekday: 'ddd, MMM D',
|
|
125
|
-
monthAndYear: 'MMMM YYYY',
|
|
126
|
-
monthAndDate: 'MMMM D',
|
|
127
124
|
fullTime: 'LT',
|
|
128
125
|
fullTime12h: 'hh:mm A',
|
|
129
126
|
fullTime24h: 'HH:mm',
|
|
130
|
-
fullDateTime: 'lll',
|
|
131
|
-
fullDateTime12h: 'll hh:mm A',
|
|
132
|
-
fullDateTime24h: 'll HH:mm',
|
|
133
127
|
keyboardDateTime: 'L LT',
|
|
134
128
|
keyboardDateTime12h: 'L hh:mm A',
|
|
135
129
|
keyboardDateTime24h: 'L HH:mm'
|
|
@@ -185,21 +179,6 @@ class AdapterMoment {
|
|
|
185
179
|
}
|
|
186
180
|
return value.locale(expectedLocale);
|
|
187
181
|
};
|
|
188
|
-
/**
|
|
189
|
-
* Some methods from moment can't take the locale as a parameter and always use the current locale.
|
|
190
|
-
* To respect the adapter locale, we need to set it as the current locale and then reset the previous locale.
|
|
191
|
-
*/
|
|
192
|
-
this.syncMomentLocale = runner => {
|
|
193
|
-
const momentLocale = _moment.default.locale();
|
|
194
|
-
const adapterLocale = this.locale ?? 'en-us';
|
|
195
|
-
if (momentLocale !== adapterLocale) {
|
|
196
|
-
_moment.default.locale(adapterLocale);
|
|
197
|
-
const result = runner();
|
|
198
|
-
_moment.default.locale(momentLocale);
|
|
199
|
-
return result;
|
|
200
|
-
}
|
|
201
|
-
return runner();
|
|
202
|
-
};
|
|
203
182
|
this.hasTimezonePlugin = () => typeof this.moment.tz !== 'undefined';
|
|
204
183
|
this.createSystemDate = value => {
|
|
205
184
|
const parsedValue = this.moment(value).local();
|
|
@@ -285,12 +264,6 @@ class AdapterMoment {
|
|
|
285
264
|
this.toJsDate = value => {
|
|
286
265
|
return value.toDate();
|
|
287
266
|
};
|
|
288
|
-
this.parseISO = isoString => {
|
|
289
|
-
return this.moment(isoString, true);
|
|
290
|
-
};
|
|
291
|
-
this.toISO = value => {
|
|
292
|
-
return value.toISOString();
|
|
293
|
-
};
|
|
294
267
|
this.parse = (value, format) => {
|
|
295
268
|
if (value === '') {
|
|
296
269
|
return null;
|
|
@@ -317,14 +290,11 @@ class AdapterMoment {
|
|
|
317
290
|
return token;
|
|
318
291
|
}).join('');
|
|
319
292
|
};
|
|
320
|
-
this.getFormatHelperText = format => {
|
|
321
|
-
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
322
|
-
};
|
|
323
|
-
this.isNull = value => {
|
|
324
|
-
return value === null;
|
|
325
|
-
};
|
|
326
293
|
this.isValid = value => {
|
|
327
|
-
|
|
294
|
+
if (value == null) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
return value.isValid();
|
|
328
298
|
};
|
|
329
299
|
this.format = (value, formatKey) => {
|
|
330
300
|
return this.formatByString(value, this.formats[formatKey]);
|
|
@@ -337,14 +307,14 @@ class AdapterMoment {
|
|
|
337
307
|
this.formatNumber = numberToFormat => {
|
|
338
308
|
return numberToFormat;
|
|
339
309
|
};
|
|
340
|
-
this.getDiff = (value, comparing, unit) => {
|
|
341
|
-
return value.diff(comparing, unit);
|
|
342
|
-
};
|
|
343
310
|
this.isEqual = (value, comparing) => {
|
|
344
311
|
if (value === null && comparing === null) {
|
|
345
312
|
return true;
|
|
346
313
|
}
|
|
347
|
-
|
|
314
|
+
if (value === null || comparing === null) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
return value.isSame(comparing);
|
|
348
318
|
};
|
|
349
319
|
this.isSameYear = (value, comparing) => {
|
|
350
320
|
return value.isSame(comparing, 'year');
|
|
@@ -469,25 +439,6 @@ class AdapterMoment {
|
|
|
469
439
|
this.getDaysInMonth = value => {
|
|
470
440
|
return value.daysInMonth();
|
|
471
441
|
};
|
|
472
|
-
this.getNextMonth = value => {
|
|
473
|
-
return value.clone().add(1, 'month');
|
|
474
|
-
};
|
|
475
|
-
this.getPreviousMonth = value => {
|
|
476
|
-
return value.clone().subtract(1, 'month');
|
|
477
|
-
};
|
|
478
|
-
this.getMonthArray = value => {
|
|
479
|
-
const firstMonth = this.startOfYear(value);
|
|
480
|
-
const monthArray = [firstMonth];
|
|
481
|
-
while (monthArray.length < 12) {
|
|
482
|
-
const prevMonth = monthArray[monthArray.length - 1];
|
|
483
|
-
monthArray.push(this.getNextMonth(prevMonth));
|
|
484
|
-
}
|
|
485
|
-
return monthArray;
|
|
486
|
-
};
|
|
487
|
-
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
488
|
-
return dateParam.clone().hour(timeParam.hour()).minute(timeParam.minute()).second(timeParam.second());
|
|
489
|
-
};
|
|
490
|
-
this.getWeekdays = () => this.syncMomentLocale(() => _moment.default.weekdaysShort(true));
|
|
491
442
|
this.getWeekArray = value => {
|
|
492
443
|
const cleanValue = this.setLocaleToValue(value);
|
|
493
444
|
const start = cleanValue.clone().startOf('month').startOf('week');
|
|
@@ -507,7 +458,7 @@ class AdapterMoment {
|
|
|
507
458
|
this.getWeekNumber = value => {
|
|
508
459
|
return value.week();
|
|
509
460
|
};
|
|
510
|
-
this.getYearRange = (start, end) => {
|
|
461
|
+
this.getYearRange = ([start, end]) => {
|
|
511
462
|
const startDate = this.moment(start).startOf('year');
|
|
512
463
|
const endDate = this.moment(end).endOf('year');
|
|
513
464
|
const years = [];
|
|
@@ -518,13 +469,6 @@ class AdapterMoment {
|
|
|
518
469
|
}
|
|
519
470
|
return years;
|
|
520
471
|
};
|
|
521
|
-
this.getMeridiemText = ampm => {
|
|
522
|
-
if (this.is12HourCycleInCurrentLocale()) {
|
|
523
|
-
// AM/PM translation only possible in those who have 12 hour cycle in locale.
|
|
524
|
-
return _moment.default.localeData(this.getCurrentLocaleCode()).meridiem(ampm === 'am' ? 0 : 13, 0, false);
|
|
525
|
-
}
|
|
526
|
-
return ampm === 'am' ? 'AM' : 'PM'; // fallback for de, ru, ...etc
|
|
527
|
-
};
|
|
528
472
|
this.moment = instance || _moment.default;
|
|
529
473
|
this.locale = locale;
|
|
530
474
|
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
@@ -87,19 +87,13 @@ const defaultFormats = {
|
|
|
87
87
|
minutes: 'mm',
|
|
88
88
|
seconds: 'ss',
|
|
89
89
|
fullDate: 'iYYYY, iMMMM Do',
|
|
90
|
-
fullDateWithWeekday: 'iYYYY, iMMMM Do, dddd',
|
|
91
90
|
keyboardDateTime: 'iYYYY/iMM/iDD LT',
|
|
92
91
|
shortDate: 'iD iMMM',
|
|
93
92
|
normalDate: 'dddd, iD iMMM',
|
|
94
93
|
normalDateWithWeekday: 'DD iMMMM',
|
|
95
|
-
monthAndYear: 'iMMMM iYYYY',
|
|
96
|
-
monthAndDate: 'iD iMMMM',
|
|
97
94
|
fullTime: 'LT',
|
|
98
95
|
fullTime12h: 'hh:mm A',
|
|
99
96
|
fullTime24h: 'HH:mm',
|
|
100
|
-
fullDateTime: 'iYYYY, iMMMM Do, hh:mm A',
|
|
101
|
-
fullDateTime12h: 'iD iMMMM hh:mm A',
|
|
102
|
-
fullDateTime24h: 'iD iMMMM HH:mm',
|
|
103
97
|
keyboardDate: 'iYYYY/iMM/iDD',
|
|
104
98
|
keyboardDateTime12h: 'iYYYY/iMM/iDD hh:mm A',
|
|
105
99
|
keyboardDateTime24h: 'iYYYY/iMM/iDD HH:mm'
|
|
@@ -176,18 +170,9 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
|
|
|
176
170
|
}
|
|
177
171
|
return this.moment(value, format, true).locale('ar-SA');
|
|
178
172
|
};
|
|
179
|
-
this.getFormatHelperText = format => {
|
|
180
|
-
return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
|
|
181
|
-
};
|
|
182
173
|
this.formatNumber = numberToFormat => {
|
|
183
174
|
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
|
184
175
|
};
|
|
185
|
-
this.isEqual = (value, comparing) => {
|
|
186
|
-
if (value === null && comparing === null) {
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
return this.moment(value).isSame(comparing);
|
|
190
|
-
};
|
|
191
176
|
this.startOfYear = value => {
|
|
192
177
|
return value.clone().startOf('iYear');
|
|
193
178
|
};
|
|
@@ -224,17 +209,6 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
|
|
|
224
209
|
this.setDate = (value, date) => {
|
|
225
210
|
return value.clone().iDate(date);
|
|
226
211
|
};
|
|
227
|
-
this.getNextMonth = value => {
|
|
228
|
-
return value.clone().add(1, 'iMonth');
|
|
229
|
-
};
|
|
230
|
-
this.getPreviousMonth = value => {
|
|
231
|
-
return value.clone().subtract(1, 'iMonth');
|
|
232
|
-
};
|
|
233
|
-
this.getWeekdays = () => {
|
|
234
|
-
return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
|
|
235
|
-
return this.date().weekday(dayOfWeek).format('dd');
|
|
236
|
-
});
|
|
237
|
-
};
|
|
238
212
|
this.getWeekArray = value => {
|
|
239
213
|
const start = value.clone().startOf('iMonth').startOf('week');
|
|
240
214
|
const end = value.clone().endOf('iMonth').endOf('week');
|
|
@@ -253,7 +227,7 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
|
|
|
253
227
|
this.getWeekNumber = value => {
|
|
254
228
|
return value.iWeek();
|
|
255
229
|
};
|
|
256
|
-
this.getYearRange = (start, end) => {
|
|
230
|
+
this.getYearRange = ([start, end]) => {
|
|
257
231
|
// moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
|
|
258
232
|
// We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
|
|
259
233
|
if (start.isBefore('1937-03-14')) {
|
|
@@ -272,9 +246,6 @@ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
|
|
|
272
246
|
}
|
|
273
247
|
return years;
|
|
274
248
|
};
|
|
275
|
-
this.getMeridiemText = ampm => {
|
|
276
|
-
return ampm === 'am' ? this.date().hours(2).format('A') : this.date().hours(14).format('A');
|
|
277
|
-
};
|
|
278
249
|
this.moment = instance || _momentHijri.default;
|
|
279
250
|
this.locale = 'ar-SA';
|
|
280
251
|
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
@@ -85,19 +85,13 @@ const defaultFormats = {
|
|
|
85
85
|
minutes: 'mm',
|
|
86
86
|
seconds: 'ss',
|
|
87
87
|
fullDate: 'jYYYY, jMMMM Do',
|
|
88
|
-
fullDateWithWeekday: 'dddd Do jMMMM jYYYY',
|
|
89
88
|
keyboardDate: 'jYYYY/jMM/jDD',
|
|
90
89
|
shortDate: 'jD jMMM',
|
|
91
90
|
normalDate: 'dddd, jD jMMM',
|
|
92
91
|
normalDateWithWeekday: 'DD MMMM',
|
|
93
|
-
monthAndYear: 'jMMMM jYYYY',
|
|
94
|
-
monthAndDate: 'jD jMMMM',
|
|
95
92
|
fullTime: 'LT',
|
|
96
93
|
fullTime12h: 'hh:mm A',
|
|
97
94
|
fullTime24h: 'HH:mm',
|
|
98
|
-
fullDateTime: 'jYYYY, jMMMM Do, hh:mm A',
|
|
99
|
-
fullDateTime12h: 'jD jMMMM hh:mm A',
|
|
100
|
-
fullDateTime24h: 'jD jMMMM HH:mm',
|
|
101
95
|
keyboardDateTime: 'jYYYY/jMM/jDD LT',
|
|
102
96
|
keyboardDateTime12h: 'jYYYY/jMM/jDD hh:mm A',
|
|
103
97
|
keyboardDateTime24h: 'jYYYY/jMM/jDD HH:mm'
|
|
@@ -168,34 +162,15 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
|
|
|
168
162
|
this.setTimezone = value => {
|
|
169
163
|
return value;
|
|
170
164
|
};
|
|
171
|
-
this.parseISO = isoString => {
|
|
172
|
-
return this.moment(isoString).locale('fa');
|
|
173
|
-
};
|
|
174
165
|
this.parse = (value, format) => {
|
|
175
166
|
if (value === '') {
|
|
176
167
|
return null;
|
|
177
168
|
}
|
|
178
169
|
return this.moment(value, format, true).locale('fa');
|
|
179
170
|
};
|
|
180
|
-
this.getFormatHelperText = format => {
|
|
181
|
-
return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
|
|
182
|
-
};
|
|
183
|
-
this.isValid = value => {
|
|
184
|
-
// We can't to `this.moment(value)` because moment-jalaali looses the invalidity information when creating a new moment object from an existing one
|
|
185
|
-
if (!this.moment.isMoment(value)) {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
return value.isValid();
|
|
189
|
-
};
|
|
190
171
|
this.formatNumber = numberToFormat => {
|
|
191
172
|
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
|
192
173
|
};
|
|
193
|
-
this.isEqual = (value, comparing) => {
|
|
194
|
-
if (value === null && comparing === null) {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
return this.moment(value).isSame(comparing);
|
|
198
|
-
};
|
|
199
174
|
this.isSameYear = (value, comparing) => {
|
|
200
175
|
// `isSame` seems to mutate the date on `moment-jalaali`
|
|
201
176
|
// @ts-ignore
|
|
@@ -248,17 +223,6 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
|
|
|
248
223
|
this.setDate = (value, date) => {
|
|
249
224
|
return value.clone().jDate(date);
|
|
250
225
|
};
|
|
251
|
-
this.getNextMonth = value => {
|
|
252
|
-
return value.clone().add(1, 'jMonth');
|
|
253
|
-
};
|
|
254
|
-
this.getPreviousMonth = value => {
|
|
255
|
-
return value.clone().subtract(1, 'jMonth');
|
|
256
|
-
};
|
|
257
|
-
this.getWeekdays = () => {
|
|
258
|
-
return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
|
|
259
|
-
return this.date().weekday(dayOfWeek).format('dd');
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
226
|
this.getWeekArray = value => {
|
|
263
227
|
const start = value.clone().startOf('jMonth').startOf('week');
|
|
264
228
|
const end = value.clone().endOf('jMonth').endOf('week');
|
|
@@ -277,7 +241,7 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
|
|
|
277
241
|
this.getWeekNumber = value => {
|
|
278
242
|
return value.jWeek();
|
|
279
243
|
};
|
|
280
|
-
this.getYearRange = (start, end) => {
|
|
244
|
+
this.getYearRange = ([start, end]) => {
|
|
281
245
|
const startDate = this.moment(start).startOf('jYear');
|
|
282
246
|
const endDate = this.moment(end).endOf('jYear');
|
|
283
247
|
const years = [];
|
|
@@ -288,9 +252,6 @@ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
|
|
|
288
252
|
}
|
|
289
253
|
return years;
|
|
290
254
|
};
|
|
291
|
-
this.getMeridiemText = ampm => {
|
|
292
|
-
return ampm === 'am' ? this.date().hours(2).format('A') : this.date().hours(14).format('A');
|
|
293
|
-
};
|
|
294
255
|
this.moment = instance || _momentJalaali.default;
|
|
295
256
|
this.locale = 'fa';
|
|
296
257
|
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
@@ -29,7 +29,7 @@ var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
|
|
|
29
29
|
var _valueManagers = require("../internals/utils/valueManagers");
|
|
30
30
|
var _dimensions = require("../internals/constants/dimensions");
|
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
|
-
const _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "showDaysOutsideCurrentMonth", "fixedWeekNumber", "dayOfWeekFormatter", "
|
|
32
|
+
const _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "showDaysOutsideCurrentMonth", "fixedWeekNumber", "dayOfWeekFormatter", "slots", "slotProps", "loading", "renderLoading", "displayWeekNumber", "yearsPerRow", "monthsPerRow", "timezone"];
|
|
33
33
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
34
34
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
35
|
const useUtilityClasses = ownerState => {
|
|
@@ -123,8 +123,6 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
|
|
|
123
123
|
showDaysOutsideCurrentMonth,
|
|
124
124
|
fixedWeekNumber,
|
|
125
125
|
dayOfWeekFormatter,
|
|
126
|
-
components,
|
|
127
|
-
componentsProps,
|
|
128
126
|
slots,
|
|
129
127
|
slotProps,
|
|
130
128
|
loading,
|
|
@@ -191,10 +189,10 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
|
|
|
191
189
|
const maxDateWithDisabled = disabled && value || maxDate;
|
|
192
190
|
const gridLabelId = `${id}-grid-label`;
|
|
193
191
|
const hasFocus = focusedView !== null;
|
|
194
|
-
const CalendarHeader = slots?.calendarHeader ??
|
|
192
|
+
const CalendarHeader = slots?.calendarHeader ?? _PickersCalendarHeader.PickersCalendarHeader;
|
|
195
193
|
const calendarHeaderProps = (0, _utils.useSlotProps)({
|
|
196
194
|
elementType: CalendarHeader,
|
|
197
|
-
externalSlotProps: slotProps?.calendarHeader
|
|
195
|
+
externalSlotProps: slotProps?.calendarHeader,
|
|
198
196
|
additionalProps: {
|
|
199
197
|
views,
|
|
200
198
|
view,
|
|
@@ -345,8 +343,6 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
|
|
|
345
343
|
fixedWeekNumber: fixedWeekNumber,
|
|
346
344
|
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
347
345
|
displayWeekNumber: displayWeekNumber,
|
|
348
|
-
components: components,
|
|
349
|
-
componentsProps: componentsProps,
|
|
350
346
|
slots: slots,
|
|
351
347
|
slotProps: slotProps,
|
|
352
348
|
loading: loading,
|
|
@@ -370,21 +366,8 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
370
366
|
autoFocus: _propTypes.default.bool,
|
|
371
367
|
classes: _propTypes.default.object,
|
|
372
368
|
className: _propTypes.default.string,
|
|
373
|
-
/**
|
|
374
|
-
* Overridable components.
|
|
375
|
-
* @default {}
|
|
376
|
-
* @deprecated Please use `slots`.
|
|
377
|
-
*/
|
|
378
|
-
components: _propTypes.default.object,
|
|
379
|
-
/**
|
|
380
|
-
* The props used for each component slot.
|
|
381
|
-
* @default {}
|
|
382
|
-
* @deprecated Please use `slotProps`.
|
|
383
|
-
*/
|
|
384
|
-
componentsProps: _propTypes.default.object,
|
|
385
369
|
/**
|
|
386
370
|
* Formats the day of week displayed in the calendar header.
|
|
387
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
388
371
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
389
372
|
* @returns {string} The name to display.
|
|
390
373
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|