@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
|
@@ -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
|
-
|
|
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
|
-
|
|
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 (
|
|
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.
|
|
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;
|
|
@@ -277,35 +263,36 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
277
263
|
};
|
|
278
264
|
this.expandFormat = function (format) {
|
|
279
265
|
// Extract escaped section to avoid extending them
|
|
280
|
-
var
|
|
281
|
-
|
|
266
|
+
var catchEscapedSectionsRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
267
|
+
|
|
268
|
+
// Extract words to test if they are a token or a word to escape.
|
|
269
|
+
var catchWordsRegexp = /(?:^|[^a-z])([a-z]+)(?:[^a-z]|$)|([a-z]+)/gi;
|
|
270
|
+
return format.match(catchEscapedSectionsRegexp).map(function (token) {
|
|
282
271
|
var firstCharacter = token[0];
|
|
283
272
|
if (firstCharacter === "'") {
|
|
284
273
|
return token;
|
|
285
274
|
}
|
|
286
|
-
|
|
275
|
+
var expandedToken = DateTime.expandFormat(token, {
|
|
287
276
|
locale: _this.locale
|
|
288
277
|
});
|
|
278
|
+
return expandedToken.replace(catchWordsRegexp, function (correspondance, g1, g2) {
|
|
279
|
+
var word = g1 || g2; // words are either in group 1 or group 2
|
|
280
|
+
if (word === 'yyyyy' || formatTokenMap[word] !== undefined) {
|
|
281
|
+
return correspondance;
|
|
282
|
+
}
|
|
283
|
+
return "'".concat(correspondance, "'");
|
|
284
|
+
});
|
|
289
285
|
}).join('')
|
|
290
286
|
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
|
291
287
|
// This value is supported by luxon parser but not luxon formatter.
|
|
292
288
|
// To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
|
|
293
289
|
.replace('yyyyy', 'yyyy');
|
|
294
290
|
};
|
|
295
|
-
this.getFormatHelperText = function (format) {
|
|
296
|
-
return _this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
297
|
-
};
|
|
298
|
-
this.isNull = function (value) {
|
|
299
|
-
return value === null;
|
|
300
|
-
};
|
|
301
291
|
this.isValid = function (value) {
|
|
302
|
-
if (DateTime.isDateTime(value)) {
|
|
303
|
-
return value.isValid;
|
|
304
|
-
}
|
|
305
292
|
if (value === null) {
|
|
306
293
|
return false;
|
|
307
294
|
}
|
|
308
|
-
return
|
|
295
|
+
return value.isValid;
|
|
309
296
|
};
|
|
310
297
|
this.format = function (value, formatKey) {
|
|
311
298
|
return _this.formatByString(value, _this.formats[formatKey]);
|
|
@@ -316,25 +303,14 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
316
303
|
this.formatNumber = function (numberToFormat) {
|
|
317
304
|
return numberToFormat;
|
|
318
305
|
};
|
|
319
|
-
this.getDiff = function (value, comparing, unit) {
|
|
320
|
-
if (typeof comparing === 'string') {
|
|
321
|
-
comparing = DateTime.fromJSDate(new Date(comparing));
|
|
322
|
-
}
|
|
323
|
-
if (unit) {
|
|
324
|
-
return Math.floor(value.diff(comparing).as(unit));
|
|
325
|
-
}
|
|
326
|
-
return value.diff(comparing).as('millisecond');
|
|
327
|
-
};
|
|
328
306
|
this.isEqual = function (value, comparing) {
|
|
329
307
|
if (value === null && comparing === null) {
|
|
330
308
|
return true;
|
|
331
309
|
}
|
|
332
|
-
|
|
333
|
-
// Make sure that null will not be passed to this.date
|
|
334
310
|
if (value === null || comparing === null) {
|
|
335
311
|
return false;
|
|
336
312
|
}
|
|
337
|
-
return +
|
|
313
|
+
return +value === +comparing;
|
|
338
314
|
};
|
|
339
315
|
this.isSameYear = function (value, comparing) {
|
|
340
316
|
var comparingInValueTimezone = _this.setTimezone(comparing, _this.getTimezone(value));
|
|
@@ -503,37 +479,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
503
479
|
this.getDaysInMonth = function (value) {
|
|
504
480
|
return value.daysInMonth;
|
|
505
481
|
};
|
|
506
|
-
this.getNextMonth = function (value) {
|
|
507
|
-
return value.plus({
|
|
508
|
-
months: 1
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
|
-
this.getPreviousMonth = function (value) {
|
|
512
|
-
return value.minus({
|
|
513
|
-
months: 1
|
|
514
|
-
});
|
|
515
|
-
};
|
|
516
|
-
this.getMonthArray = function (value) {
|
|
517
|
-
var firstMonth = value.startOf('year');
|
|
518
|
-
var monthArray = [firstMonth];
|
|
519
|
-
while (monthArray.length < 12) {
|
|
520
|
-
var prevMonth = monthArray[monthArray.length - 1];
|
|
521
|
-
monthArray.push(_this.addMonths(prevMonth, 1));
|
|
522
|
-
}
|
|
523
|
-
return monthArray;
|
|
524
|
-
};
|
|
525
|
-
this.mergeDateAndTime = function (dateParam, timeParam) {
|
|
526
|
-
return dateParam.set({
|
|
527
|
-
second: timeParam.second,
|
|
528
|
-
hour: timeParam.hour,
|
|
529
|
-
minute: timeParam.minute
|
|
530
|
-
});
|
|
531
|
-
};
|
|
532
|
-
this.getWeekdays = function () {
|
|
533
|
-
return Info.weekdaysFormat('narrow', {
|
|
534
|
-
locale: _this.locale
|
|
535
|
-
});
|
|
536
|
-
};
|
|
537
482
|
this.getWeekArray = function (value) {
|
|
538
483
|
var cleanValue = _this.setLocaleToValue(value);
|
|
539
484
|
var _cleanValue$endOf$end = cleanValue.endOf('month').endOf('week').diff(cleanValue.startOf('month').startOf('week'), 'days').toObject(),
|
|
@@ -557,7 +502,10 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
557
502
|
this.getWeekNumber = function (value) {
|
|
558
503
|
return value.weekNumber;
|
|
559
504
|
};
|
|
560
|
-
this.getYearRange = function (
|
|
505
|
+
this.getYearRange = function (_ref4) {
|
|
506
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
507
|
+
start = _ref5[0],
|
|
508
|
+
end = _ref5[1];
|
|
561
509
|
var startDate = start.startOf('year');
|
|
562
510
|
var endDate = end.endOf('year');
|
|
563
511
|
var current = startDate;
|
|
@@ -570,13 +518,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
570
518
|
}
|
|
571
519
|
return years;
|
|
572
520
|
};
|
|
573
|
-
this.getMeridiemText = function (ampm) {
|
|
574
|
-
return Info.meridiems({
|
|
575
|
-
locale: _this.locale
|
|
576
|
-
}).find(function (v) {
|
|
577
|
-
return v.toLowerCase() === ampm.toLowerCase();
|
|
578
|
-
});
|
|
579
|
-
};
|
|
580
521
|
this.locale = locale || 'en-US';
|
|
581
522
|
this.formats = _extends({}, defaultFormats, formats);
|
|
582
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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);
|