@mui/x-date-pickers 7.0.0-alpha.0 → 7.0.0-alpha.2
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 +6 -17
- package/AdapterDateFns/AdapterDateFns.js +9 -93
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +6 -17
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
- package/AdapterDayjs/AdapterDayjs.d.ts +7 -19
- package/AdapterDayjs/AdapterDayjs.js +13 -67
- package/AdapterLuxon/AdapterLuxon.d.ts +6 -17
- package/AdapterLuxon/AdapterLuxon.js +5 -96
- package/AdapterMoment/AdapterMoment.d.ts +6 -22
- package/AdapterMoment/AdapterMoment.js +11 -75
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -9
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -11
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
- package/CHANGELOG.md +591 -5
- package/DateCalendar/DateCalendar.js +2 -9
- package/DateCalendar/DateCalendar.types.d.ts +0 -4
- package/DateCalendar/DayCalendar.d.ts +1 -2
- package/DateCalendar/DayCalendar.js +9 -16
- package/DateCalendar/dayCalendarClasses.d.ts +1 -1
- package/DateCalendar/dayCalendarClasses.js +1 -1
- package/DateCalendar/index.d.ts +1 -2
- package/DateCalendar/index.js +2 -4
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DateCalendar/useCalendarState.js +1 -9
- package/DateField/DateField.js +1 -1
- package/DatePicker/DatePicker.js +1 -6
- package/DatePicker/shared.d.ts +1 -1
- package/DateTimeField/DateTimeField.js +1 -9
- package/DateTimePicker/DateTimePicker.js +1 -14
- package/DateTimePicker/shared.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/DigitalClock/DigitalClock.js +6 -17
- package/LocalizationProvider/LocalizationProvider.js +0 -6
- package/MobileDatePicker/MobileDatePicker.js +1 -6
- package/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/MobileTimePicker/MobileTimePicker.js +1 -9
- package/MonthCalendar/MonthCalendar.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/PickersDay/PickersDay.js +1 -1
- package/StaticDatePicker/StaticDatePicker.js +1 -6
- package/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/StaticTimePicker/StaticTimePicker.js +1 -9
- package/TimeClock/Clock.js +1 -1
- package/TimeClock/TimeClock.js +3 -15
- package/TimeField/TimeField.js +1 -9
- package/TimePicker/TimePicker.js +1 -9
- package/TimePicker/shared.d.ts +1 -1
- package/YearCalendar/YearCalendar.js +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.js +0 -2
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -0
- package/internals/hooks/date-helpers-hooks.js +2 -2
- package/internals/hooks/useField/useField.utils.js +8 -9
- package/internals/hooks/useField/useFieldState.js +2 -2
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +1 -1
- package/internals/hooks/useUtils.js +1 -1
- package/internals/hooks/useViews.js +2 -2
- package/internals/models/validation.d.ts +0 -8
- package/internals/utils/date-utils.js +2 -2
- package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
- package/internals/utils/getDefaultReferenceDate.js +0 -4
- package/internals/utils/validation/extractValidationProps.d.ts +1 -1
- package/internals/utils/validation/extractValidationProps.js +1 -1
- package/internals/utils/validation/validateDate.js +1 -1
- package/internals/utils/validation/validateTime.js +1 -8
- package/legacy/AdapterDateFns/AdapterDateFns.js +13 -94
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +13 -94
- package/legacy/AdapterDayjs/AdapterDayjs.js +19 -69
- package/legacy/AdapterLuxon/AdapterLuxon.js +10 -97
- package/legacy/AdapterMoment/AdapterMoment.js +16 -78
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -33
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -43
- package/legacy/DateCalendar/DateCalendar.js +2 -9
- package/legacy/DateCalendar/DayCalendar.js +7 -11
- package/legacy/DateCalendar/PickersSlideTransition.js +8 -9
- package/legacy/DateCalendar/dayCalendarClasses.js +1 -1
- package/legacy/DateCalendar/index.js +2 -4
- package/legacy/DateCalendar/useCalendarState.js +1 -9
- package/legacy/DateField/DateField.js +1 -1
- package/legacy/DatePicker/DatePicker.js +1 -6
- package/legacy/DateTimeField/DateTimeField.js +1 -9
- package/legacy/DateTimePicker/DateTimePicker.js +1 -14
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/legacy/DigitalClock/DigitalClock.js +6 -17
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
- package/legacy/MobileDatePicker/MobileDatePicker.js +1 -6
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/legacy/MobileTimePicker/MobileTimePicker.js +1 -9
- package/legacy/MonthCalendar/MonthCalendar.js +1 -1
- package/legacy/MonthCalendar/PickersMonth.js +4 -5
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +11 -3
- package/legacy/PickersDay/PickersDay.js +6 -7
- package/legacy/PickersLayout/PickersLayout.js +5 -6
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -6
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/legacy/StaticTimePicker/StaticTimePicker.js +1 -9
- package/legacy/TimeClock/Clock.js +1 -1
- package/legacy/TimeClock/ClockNumber.js +4 -5
- package/legacy/TimeClock/TimeClock.js +3 -15
- package/legacy/TimeField/TimeField.js +1 -9
- package/legacy/TimePicker/TimePicker.js +1 -9
- package/legacy/TimePicker/TimePickerToolbar.js +1 -2
- package/legacy/YearCalendar/PickersYear.js +4 -5
- package/legacy/YearCalendar/YearCalendar.js +2 -2
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/legacy/dateViewRenderers/dateViewRenderers.js +0 -2
- package/legacy/index.js +4 -1
- package/legacy/internals/components/PickersModalDialog.js +3 -4
- package/legacy/internals/hooks/date-helpers-hooks.js +2 -2
- package/legacy/internals/hooks/useField/useField.utils.js +8 -9
- package/legacy/internals/hooks/useField/useFieldState.js +2 -2
- package/legacy/internals/hooks/useUtils.js +1 -1
- package/legacy/internals/hooks/useViews.js +2 -2
- package/legacy/internals/utils/date-utils.js +2 -2
- package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
- package/legacy/internals/utils/validation/extractValidationProps.js +1 -1
- package/legacy/internals/utils/validation/validateDate.js +1 -1
- package/legacy/internals/utils/validation/validateTime.js +1 -8
- package/legacy/locales/deDE.js +4 -3
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/mk.js +91 -0
- package/legacy/timeViewRenderers/timeViewRenderers.js +0 -6
- package/locales/deDE.js +2 -3
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/mk.d.ts +53 -0
- package/locales/mk.js +55 -0
- package/models/adapters.d.ts +16 -145
- package/models/fields.d.ts +0 -6
- package/models/timezone.d.ts +1 -1
- package/models/validation.d.ts +1 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +9 -93
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
- package/modern/AdapterDayjs/AdapterDayjs.js +13 -66
- package/modern/AdapterLuxon/AdapterLuxon.js +5 -96
- package/modern/AdapterMoment/AdapterMoment.js +11 -74
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
- package/modern/DateCalendar/DateCalendar.js +2 -9
- package/modern/DateCalendar/DayCalendar.js +9 -15
- package/modern/DateCalendar/dayCalendarClasses.js +1 -1
- package/modern/DateCalendar/index.js +2 -4
- package/modern/DateCalendar/useCalendarState.js +1 -9
- package/modern/DateField/DateField.js +1 -1
- package/modern/DatePicker/DatePicker.js +1 -6
- package/modern/DateTimeField/DateTimeField.js +1 -9
- package/modern/DateTimePicker/DateTimePicker.js +1 -14
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/modern/DigitalClock/DigitalClock.js +6 -17
- package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -6
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/modern/MobileTimePicker/MobileTimePicker.js +1 -9
- package/modern/MonthCalendar/MonthCalendar.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/modern/PickersDay/PickersDay.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -6
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/modern/StaticTimePicker/StaticTimePicker.js +1 -9
- package/modern/TimeClock/Clock.js +1 -1
- package/modern/TimeClock/TimeClock.js +3 -15
- package/modern/TimeField/TimeField.js +1 -9
- package/modern/TimePicker/TimePicker.js +1 -9
- package/modern/YearCalendar/YearCalendar.js +2 -2
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/modern/dateViewRenderers/dateViewRenderers.js +0 -2
- package/modern/index.js +4 -1
- package/modern/internals/hooks/date-helpers-hooks.js +2 -2
- package/modern/internals/hooks/useField/useField.utils.js +8 -9
- package/modern/internals/hooks/useField/useFieldState.js +2 -2
- package/modern/internals/hooks/useUtils.js +1 -1
- package/modern/internals/hooks/useViews.js +2 -2
- package/modern/internals/utils/date-utils.js +2 -2
- package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
- package/modern/internals/utils/validation/extractValidationProps.js +1 -1
- package/modern/internals/utils/validation/validateDate.js +1 -1
- package/modern/internals/utils/validation/validateTime.js +1 -8
- package/modern/locales/deDE.js +2 -3
- package/modern/locales/index.js +1 -0
- package/modern/locales/mk.js +55 -0
- package/modern/timeViewRenderers/timeViewRenderers.js +0 -6
- package/node/AdapterDateFns/AdapterDateFns.js +9 -93
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
- package/node/AdapterDayjs/AdapterDayjs.js +13 -66
- package/node/AdapterLuxon/AdapterLuxon.js +5 -96
- package/node/AdapterMoment/AdapterMoment.js +11 -74
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
- package/node/DateCalendar/DateCalendar.js +2 -9
- package/node/DateCalendar/DayCalendar.js +9 -15
- package/node/DateCalendar/dayCalendarClasses.js +2 -2
- package/node/DateCalendar/index.js +3 -23
- package/node/DateCalendar/useCalendarState.js +1 -9
- package/node/DateField/DateField.js +1 -1
- package/node/DatePicker/DatePicker.js +1 -6
- package/node/DateTimeField/DateTimeField.js +1 -9
- package/node/DateTimePicker/DateTimePicker.js +1 -14
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/node/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/node/DigitalClock/DigitalClock.js +6 -17
- package/node/LocalizationProvider/LocalizationProvider.js +0 -6
- package/node/MobileDatePicker/MobileDatePicker.js +1 -6
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/node/MobileTimePicker/MobileTimePicker.js +1 -9
- package/node/MonthCalendar/MonthCalendar.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/node/PickersDay/PickersDay.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +1 -6
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/node/StaticTimePicker/StaticTimePicker.js +1 -9
- package/node/TimeClock/Clock.js +1 -1
- package/node/TimeClock/TimeClock.js +3 -15
- package/node/TimeField/TimeField.js +1 -9
- package/node/TimePicker/TimePicker.js +1 -9
- package/node/YearCalendar/YearCalendar.js +2 -2
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/node/dateViewRenderers/dateViewRenderers.js +0 -2
- package/node/index.js +13 -1
- package/node/internals/hooks/date-helpers-hooks.js +2 -2
- package/node/internals/hooks/useField/useField.utils.js +8 -9
- package/node/internals/hooks/useField/useFieldState.js +2 -2
- package/node/internals/hooks/useUtils.js +1 -1
- package/node/internals/hooks/useViews.js +2 -2
- package/node/internals/utils/date-utils.js +2 -2
- package/node/internals/utils/getDefaultReferenceDate.js +1 -3
- package/node/internals/utils/validation/extractValidationProps.js +1 -1
- package/node/internals/utils/validation/validateDate.js +1 -1
- package/node/internals/utils/validation/validateTime.js +1 -8
- package/node/locales/deDE.js +2 -3
- package/node/locales/index.js +11 -0
- package/node/locales/mk.js +60 -0
- package/node/timeViewRenderers/timeViewRenderers.js +0 -6
- package/package.json +7 -6
- package/themeAugmentation/overrides.d.ts +1 -1
- package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
- package/timeViewRenderers/timeViewRenderers.js +0 -6
|
@@ -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'
|
|
@@ -190,28 +184,7 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
190
184
|
return value.setLocale(expectedLocale);
|
|
191
185
|
};
|
|
192
186
|
this.date = function (value) {
|
|
193
|
-
|
|
194
|
-
return DateTime.local();
|
|
195
|
-
}
|
|
196
|
-
if (value === null) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
if (typeof value === 'string') {
|
|
200
|
-
// @ts-ignore
|
|
201
|
-
return DateTime.fromJSDate(new Date(value), {
|
|
202
|
-
locale: _this.locale
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
if (DateTime.isDateTime(value)) {
|
|
206
|
-
return value;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// @ts-ignore
|
|
210
|
-
return DateTime.fromJSDate(value, {
|
|
211
|
-
locale: _this.locale
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
this.dateWithTimezone = function (value, timezone) {
|
|
187
|
+
var timezone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
215
188
|
if (value === null) {
|
|
216
189
|
return null;
|
|
217
190
|
}
|
|
@@ -229,6 +202,9 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
229
202
|
zone: timezone
|
|
230
203
|
});
|
|
231
204
|
};
|
|
205
|
+
this.getInvalidDate = function () {
|
|
206
|
+
return DateTime.fromJSDate(new Date('Invalid Date'));
|
|
207
|
+
};
|
|
232
208
|
this.getTimezone = function (value) {
|
|
233
209
|
// When using the system zone, we want to return "system", not something like "Europe/Paris"
|
|
234
210
|
if (value.zone.type === 'system') {
|
|
@@ -245,14 +221,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
245
221
|
this.toJsDate = function (value) {
|
|
246
222
|
return value.toJSDate();
|
|
247
223
|
};
|
|
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
224
|
this.parse = function (value, formatString) {
|
|
257
225
|
if (value === '') {
|
|
258
226
|
return null;
|
|
@@ -302,20 +270,11 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
302
270
|
// To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
|
|
303
271
|
.replace('yyyyy', 'yyyy');
|
|
304
272
|
};
|
|
305
|
-
this.getFormatHelperText = function (format) {
|
|
306
|
-
return _this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
307
|
-
};
|
|
308
|
-
this.isNull = function (value) {
|
|
309
|
-
return value === null;
|
|
310
|
-
};
|
|
311
273
|
this.isValid = function (value) {
|
|
312
|
-
if (DateTime.isDateTime(value)) {
|
|
313
|
-
return value.isValid;
|
|
314
|
-
}
|
|
315
274
|
if (value === null) {
|
|
316
275
|
return false;
|
|
317
276
|
}
|
|
318
|
-
return
|
|
277
|
+
return value.isValid;
|
|
319
278
|
};
|
|
320
279
|
this.format = function (value, formatKey) {
|
|
321
280
|
return _this.formatByString(value, _this.formats[formatKey]);
|
|
@@ -326,25 +285,14 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
326
285
|
this.formatNumber = function (numberToFormat) {
|
|
327
286
|
return numberToFormat;
|
|
328
287
|
};
|
|
329
|
-
this.getDiff = function (value, comparing, unit) {
|
|
330
|
-
if (typeof comparing === 'string') {
|
|
331
|
-
comparing = DateTime.fromJSDate(new Date(comparing));
|
|
332
|
-
}
|
|
333
|
-
if (unit) {
|
|
334
|
-
return Math.floor(value.diff(comparing).as(unit));
|
|
335
|
-
}
|
|
336
|
-
return value.diff(comparing).as('millisecond');
|
|
337
|
-
};
|
|
338
288
|
this.isEqual = function (value, comparing) {
|
|
339
289
|
if (value === null && comparing === null) {
|
|
340
290
|
return true;
|
|
341
291
|
}
|
|
342
|
-
|
|
343
|
-
// Make sure that null will not be passed to this.date
|
|
344
292
|
if (value === null || comparing === null) {
|
|
345
293
|
return false;
|
|
346
294
|
}
|
|
347
|
-
return +
|
|
295
|
+
return +value === +comparing;
|
|
348
296
|
};
|
|
349
297
|
this.isSameYear = function (value, comparing) {
|
|
350
298
|
var comparingInValueTimezone = _this.setTimezone(comparing, _this.getTimezone(value));
|
|
@@ -513,37 +461,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
513
461
|
this.getDaysInMonth = function (value) {
|
|
514
462
|
return value.daysInMonth;
|
|
515
463
|
};
|
|
516
|
-
this.getNextMonth = function (value) {
|
|
517
|
-
return value.plus({
|
|
518
|
-
months: 1
|
|
519
|
-
});
|
|
520
|
-
};
|
|
521
|
-
this.getPreviousMonth = function (value) {
|
|
522
|
-
return value.minus({
|
|
523
|
-
months: 1
|
|
524
|
-
});
|
|
525
|
-
};
|
|
526
|
-
this.getMonthArray = function (value) {
|
|
527
|
-
var firstMonth = value.startOf('year');
|
|
528
|
-
var monthArray = [firstMonth];
|
|
529
|
-
while (monthArray.length < 12) {
|
|
530
|
-
var prevMonth = monthArray[monthArray.length - 1];
|
|
531
|
-
monthArray.push(_this.addMonths(prevMonth, 1));
|
|
532
|
-
}
|
|
533
|
-
return monthArray;
|
|
534
|
-
};
|
|
535
|
-
this.mergeDateAndTime = function (dateParam, timeParam) {
|
|
536
|
-
return dateParam.set({
|
|
537
|
-
second: timeParam.second,
|
|
538
|
-
hour: timeParam.hour,
|
|
539
|
-
minute: timeParam.minute
|
|
540
|
-
});
|
|
541
|
-
};
|
|
542
|
-
this.getWeekdays = function () {
|
|
543
|
-
return Info.weekdaysFormat('narrow', {
|
|
544
|
-
locale: _this.locale
|
|
545
|
-
});
|
|
546
|
-
};
|
|
547
464
|
this.getWeekArray = function (value) {
|
|
548
465
|
var cleanValue = _this.setLocaleToValue(value);
|
|
549
466
|
var _cleanValue$endOf$end = cleanValue.endOf('month').endOf('week').diff(cleanValue.startOf('month').startOf('week'), 'days').toObject(),
|
|
@@ -567,7 +484,10 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
567
484
|
this.getWeekNumber = function (value) {
|
|
568
485
|
return value.weekNumber;
|
|
569
486
|
};
|
|
570
|
-
this.getYearRange = function (
|
|
487
|
+
this.getYearRange = function (_ref4) {
|
|
488
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
489
|
+
start = _ref5[0],
|
|
490
|
+
end = _ref5[1];
|
|
571
491
|
var startDate = start.startOf('year');
|
|
572
492
|
var endDate = end.endOf('year');
|
|
573
493
|
var current = startDate;
|
|
@@ -580,13 +500,6 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
580
500
|
}
|
|
581
501
|
return years;
|
|
582
502
|
};
|
|
583
|
-
this.getMeridiemText = function (ampm) {
|
|
584
|
-
return Info.meridiems({
|
|
585
|
-
locale: _this.locale
|
|
586
|
-
}).find(function (v) {
|
|
587
|
-
return v.toLowerCase() === ampm.toLowerCase();
|
|
588
|
-
});
|
|
589
|
-
};
|
|
590
503
|
this.locale = locale || 'en-US';
|
|
591
504
|
this.formats = _extends({}, defaultFormats, formats);
|
|
592
505
|
});
|
|
@@ -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
|
};
|
|
@@ -226,14 +204,7 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
226
204
|
return parsedValue.locale(_this.locale);
|
|
227
205
|
};
|
|
228
206
|
this.date = function (value) {
|
|
229
|
-
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
var moment = _this.moment(value);
|
|
233
|
-
moment.locale(_this.getCurrentLocaleCode());
|
|
234
|
-
return moment;
|
|
235
|
-
};
|
|
236
|
-
this.dateWithTimezone = function (value, timezone) {
|
|
207
|
+
var timezone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
237
208
|
if (value === null) {
|
|
238
209
|
return null;
|
|
239
210
|
}
|
|
@@ -245,6 +216,9 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
245
216
|
}
|
|
246
217
|
return _this.createTZDate(value, timezone);
|
|
247
218
|
};
|
|
219
|
+
this.getInvalidDate = function () {
|
|
220
|
+
return _this.moment(new Date('Invalid Date'));
|
|
221
|
+
};
|
|
248
222
|
this.getTimezone = function (value) {
|
|
249
223
|
var _value$_z, _ref2, _this$moment$defaultZ;
|
|
250
224
|
// @ts-ignore
|
|
@@ -285,12 +259,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
285
259
|
this.toJsDate = function (value) {
|
|
286
260
|
return value.toDate();
|
|
287
261
|
};
|
|
288
|
-
this.parseISO = function (isoString) {
|
|
289
|
-
return _this.moment(isoString, true);
|
|
290
|
-
};
|
|
291
|
-
this.toISO = function (value) {
|
|
292
|
-
return value.toISOString();
|
|
293
|
-
};
|
|
294
262
|
this.parse = function (value, format) {
|
|
295
263
|
if (value === '') {
|
|
296
264
|
return null;
|
|
@@ -317,14 +285,11 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
317
285
|
return token;
|
|
318
286
|
}).join('');
|
|
319
287
|
};
|
|
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
288
|
this.isValid = function (value) {
|
|
327
|
-
|
|
289
|
+
if (value == null) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
return value.isValid();
|
|
328
293
|
};
|
|
329
294
|
this.format = function (value, formatKey) {
|
|
330
295
|
return _this.formatByString(value, _this.formats[formatKey]);
|
|
@@ -337,14 +302,14 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
337
302
|
this.formatNumber = function (numberToFormat) {
|
|
338
303
|
return numberToFormat;
|
|
339
304
|
};
|
|
340
|
-
this.getDiff = function (value, comparing, unit) {
|
|
341
|
-
return value.diff(comparing, unit);
|
|
342
|
-
};
|
|
343
305
|
this.isEqual = function (value, comparing) {
|
|
344
306
|
if (value === null && comparing === null) {
|
|
345
307
|
return true;
|
|
346
308
|
}
|
|
347
|
-
|
|
309
|
+
if (value === null || comparing === null) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
return value.isSame(comparing);
|
|
348
313
|
};
|
|
349
314
|
this.isSameYear = function (value, comparing) {
|
|
350
315
|
return value.isSame(comparing, 'year');
|
|
@@ -472,29 +437,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
472
437
|
this.getDaysInMonth = function (value) {
|
|
473
438
|
return value.daysInMonth();
|
|
474
439
|
};
|
|
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
440
|
this.getWeekArray = function (value) {
|
|
499
441
|
var cleanValue = _this.setLocaleToValue(value);
|
|
500
442
|
var start = cleanValue.clone().startOf('month').startOf('week');
|
|
@@ -514,7 +456,10 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
514
456
|
this.getWeekNumber = function (value) {
|
|
515
457
|
return value.week();
|
|
516
458
|
};
|
|
517
|
-
this.getYearRange = function (
|
|
459
|
+
this.getYearRange = function (_ref5) {
|
|
460
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
461
|
+
start = _ref6[0],
|
|
462
|
+
end = _ref6[1];
|
|
518
463
|
var startDate = _this.moment(start).startOf('year');
|
|
519
464
|
var endDate = _this.moment(end).endOf('year');
|
|
520
465
|
var years = [];
|
|
@@ -525,13 +470,6 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
525
470
|
}
|
|
526
471
|
return years;
|
|
527
472
|
};
|
|
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
473
|
this.moment = instance || defaultMoment;
|
|
536
474
|
this.locale = locale;
|
|
537
475
|
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'
|
|
@@ -164,9 +159,6 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
164
159
|
}
|
|
165
160
|
return _this.moment(value).locale('ar-SA');
|
|
166
161
|
};
|
|
167
|
-
_this.dateWithTimezone = function (value) {
|
|
168
|
-
return _this.date(value);
|
|
169
|
-
};
|
|
170
162
|
_this.getTimezone = function () {
|
|
171
163
|
return 'default';
|
|
172
164
|
};
|
|
@@ -179,20 +171,11 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
179
171
|
}
|
|
180
172
|
return _this.moment(value, format, true).locale('ar-SA');
|
|
181
173
|
};
|
|
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
174
|
_this.formatNumber = function (numberToFormat) {
|
|
186
175
|
return numberToFormat.replace(/\d/g, function (match) {
|
|
187
176
|
return NUMBER_SYMBOL_MAP[match];
|
|
188
177
|
}).replace(/,/g, '،');
|
|
189
178
|
};
|
|
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
179
|
_this.startOfYear = function (value) {
|
|
197
180
|
return value.clone().startOf('iYear');
|
|
198
181
|
};
|
|
@@ -229,17 +212,6 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
229
212
|
_this.setDate = function (value, date) {
|
|
230
213
|
return value.clone().iDate(date);
|
|
231
214
|
};
|
|
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
215
|
_this.getWeekArray = function (value) {
|
|
244
216
|
var start = value.clone().startOf('iMonth').startOf('week');
|
|
245
217
|
var end = value.clone().endOf('iMonth').endOf('week');
|
|
@@ -258,7 +230,10 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
258
230
|
_this.getWeekNumber = function (value) {
|
|
259
231
|
return value.iWeek();
|
|
260
232
|
};
|
|
261
|
-
_this.getYearRange = function (
|
|
233
|
+
_this.getYearRange = function (_ref2) {
|
|
234
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
235
|
+
start = _ref3[0],
|
|
236
|
+
end = _ref3[1];
|
|
262
237
|
// moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
|
|
263
238
|
// We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
|
|
264
239
|
if (start.isBefore('1937-03-14')) {
|
|
@@ -277,9 +252,6 @@ export var AdapterMomentHijri = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
277
252
|
}
|
|
278
253
|
return years;
|
|
279
254
|
};
|
|
280
|
-
_this.getMeridiemText = function (ampm) {
|
|
281
|
-
return ampm === 'am' ? _this.date().hours(2).format('A') : _this.date().hours(14).format('A');
|
|
282
|
-
};
|
|
283
255
|
_this.moment = instance || defaultHMoment;
|
|
284
256
|
_this.locale = 'ar-SA';
|
|
285
257
|
_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'
|
|
@@ -162,45 +157,23 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
162
157
|
}
|
|
163
158
|
return _this.moment(value).locale('fa');
|
|
164
159
|
};
|
|
165
|
-
_this.dateWithTimezone = function (value) {
|
|
166
|
-
return _this.date(value);
|
|
167
|
-
};
|
|
168
160
|
_this.getTimezone = function () {
|
|
169
161
|
return 'default';
|
|
170
162
|
};
|
|
171
163
|
_this.setTimezone = function (value) {
|
|
172
164
|
return value;
|
|
173
165
|
};
|
|
174
|
-
_this.parseISO = function (isoString) {
|
|
175
|
-
return _this.moment(isoString).locale('fa');
|
|
176
|
-
};
|
|
177
166
|
_this.parse = function (value, format) {
|
|
178
167
|
if (value === '') {
|
|
179
168
|
return null;
|
|
180
169
|
}
|
|
181
170
|
return _this.moment(value, format, true).locale('fa');
|
|
182
171
|
};
|
|
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
172
|
_this.formatNumber = function (numberToFormat) {
|
|
194
173
|
return numberToFormat.replace(/\d/g, function (match) {
|
|
195
174
|
return NUMBER_SYMBOL_MAP[match];
|
|
196
175
|
}).replace(/,/g, '،');
|
|
197
176
|
};
|
|
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
177
|
_this.isSameYear = function (value, comparing) {
|
|
205
178
|
// `isSame` seems to mutate the date on `moment-jalaali`
|
|
206
179
|
// @ts-ignore
|
|
@@ -253,17 +226,6 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
253
226
|
_this.setDate = function (value, date) {
|
|
254
227
|
return value.clone().jDate(date);
|
|
255
228
|
};
|
|
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
229
|
_this.getWeekArray = function (value) {
|
|
268
230
|
var start = value.clone().startOf('jMonth').startOf('week');
|
|
269
231
|
var end = value.clone().endOf('jMonth').endOf('week');
|
|
@@ -282,7 +244,10 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
282
244
|
_this.getWeekNumber = function (value) {
|
|
283
245
|
return value.jWeek();
|
|
284
246
|
};
|
|
285
|
-
_this.getYearRange = function (
|
|
247
|
+
_this.getYearRange = function (_ref2) {
|
|
248
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
249
|
+
start = _ref3[0],
|
|
250
|
+
end = _ref3[1];
|
|
286
251
|
var startDate = _this.moment(start).startOf('jYear');
|
|
287
252
|
var endDate = _this.moment(end).endOf('jYear');
|
|
288
253
|
var years = [];
|
|
@@ -293,9 +258,6 @@ export var AdapterMomentJalaali = /*#__PURE__*/function (_AdapterMoment) {
|
|
|
293
258
|
}
|
|
294
259
|
return years;
|
|
295
260
|
};
|
|
296
|
-
_this.getMeridiemText = function (ampm) {
|
|
297
|
-
return ampm === 'am' ? _this.date().hours(2).format('A') : _this.date().hours(14).format('A');
|
|
298
|
-
};
|
|
299
261
|
_this.moment = instance || defaultJMoment;
|
|
300
262
|
_this.locale = 'fa';
|
|
301
263
|
_this.formats = _extends({}, defaultFormats, formats);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
var _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "
|
|
3
|
+
var _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenceDate", "disableFuture", "disablePast", "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"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -98,7 +98,6 @@ export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(in
|
|
|
98
98
|
referenceDateProp = props.referenceDate,
|
|
99
99
|
disableFuture = props.disableFuture,
|
|
100
100
|
disablePast = props.disablePast,
|
|
101
|
-
defaultCalendarMonth = props.defaultCalendarMonth,
|
|
102
101
|
onChange = props.onChange,
|
|
103
102
|
onYearChange = props.onYearChange,
|
|
104
103
|
onMonthChange = props.onMonthChange,
|
|
@@ -158,7 +157,6 @@ export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(in
|
|
|
158
157
|
setValueAndGoToNextView = _useViews.setValueAndGoToNextView;
|
|
159
158
|
var _useCalendarState = useCalendarState({
|
|
160
159
|
value: value,
|
|
161
|
-
defaultCalendarMonth: defaultCalendarMonth,
|
|
162
160
|
referenceDate: referenceDateProp,
|
|
163
161
|
reduceAnimations: reduceAnimations,
|
|
164
162
|
onMonthChange: onMonthChange,
|
|
@@ -371,16 +369,11 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
371
369
|
className: PropTypes.string,
|
|
372
370
|
/**
|
|
373
371
|
* Formats the day of week displayed in the calendar header.
|
|
374
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
375
372
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
376
373
|
* @returns {string} The name to display.
|
|
377
374
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
378
375
|
*/
|
|
379
376
|
dayOfWeekFormatter: PropTypes.func,
|
|
380
|
-
/**
|
|
381
|
-
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
382
|
-
*/
|
|
383
|
-
defaultCalendarMonth: PropTypes.any,
|
|
384
377
|
/**
|
|
385
378
|
* The default selected value.
|
|
386
379
|
* Used when the component is not controlled.
|
|
@@ -551,7 +544,7 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
551
544
|
* Choose which timezone to use for the value.
|
|
552
545
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
553
546
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
554
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
547
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
555
548
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
556
549
|
*/
|
|
557
550
|
timezone: PropTypes.string,
|
|
@@ -239,6 +239,7 @@ export function DayCalendar(inProps) {
|
|
|
239
239
|
props: inProps,
|
|
240
240
|
name: 'MuiDayCalendar'
|
|
241
241
|
});
|
|
242
|
+
var utils = useUtils();
|
|
242
243
|
var onFocusedDayChange = props.onFocusedDayChange,
|
|
243
244
|
className = props.className,
|
|
244
245
|
currentMonth = props.currentMonth,
|
|
@@ -264,7 +265,10 @@ export function DayCalendar(inProps) {
|
|
|
264
265
|
shouldDisableDate = props.shouldDisableDate,
|
|
265
266
|
shouldDisableMonth = props.shouldDisableMonth,
|
|
266
267
|
shouldDisableYear = props.shouldDisableYear,
|
|
267
|
-
|
|
268
|
+
_props$dayOfWeekForma = props.dayOfWeekFormatter,
|
|
269
|
+
dayOfWeekFormatter = _props$dayOfWeekForma === void 0 ? function (date) {
|
|
270
|
+
return utils.format(date, 'weekdayShort').charAt(0).toUpperCase();
|
|
271
|
+
} : _props$dayOfWeekForma,
|
|
268
272
|
hasFocus = props.hasFocus,
|
|
269
273
|
onFocusedViewChange = props.onFocusedViewChange,
|
|
270
274
|
gridLabelId = props.gridLabelId,
|
|
@@ -273,15 +277,9 @@ export function DayCalendar(inProps) {
|
|
|
273
277
|
autoFocus = props.autoFocus,
|
|
274
278
|
timezone = props.timezone;
|
|
275
279
|
var now = useNow(timezone);
|
|
276
|
-
var utils = useUtils();
|
|
277
280
|
var classes = useUtilityClasses(props);
|
|
278
281
|
var theme = useTheme();
|
|
279
282
|
var isRTL = theme.direction === 'rtl';
|
|
280
|
-
|
|
281
|
-
// before we could define this outside of the component scope, but now we need utils, which is only defined here
|
|
282
|
-
var dayOfWeekFormatter = dayOfWeekFormatterFromProps || function (_day, date) {
|
|
283
|
-
return utils.format(date, 'weekdayShort').charAt(0).toUpperCase();
|
|
284
|
-
};
|
|
285
283
|
var isDateDisabled = useIsDateDisabled({
|
|
286
284
|
shouldDisableDate: shouldDisableDate,
|
|
287
285
|
shouldDisableMonth: shouldDisableMonth,
|
|
@@ -455,15 +453,13 @@ export function DayCalendar(inProps) {
|
|
|
455
453
|
className: classes.weekNumberLabel,
|
|
456
454
|
children: localeText.calendarWeekNumberHeaderText
|
|
457
455
|
}), getWeekdays(utils, now).map(function (weekday, i) {
|
|
458
|
-
var _dayOfWeekFormatter;
|
|
459
|
-
var day = utils.format(weekday, 'weekdayShort');
|
|
460
456
|
return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
|
|
461
457
|
variant: "caption",
|
|
462
458
|
role: "columnheader",
|
|
463
459
|
"aria-label": utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday'),
|
|
464
460
|
className: classes.weekDayLabel,
|
|
465
|
-
children:
|
|
466
|
-
},
|
|
461
|
+
children: dayOfWeekFormatter(weekday)
|
|
462
|
+
}, i.toString());
|
|
467
463
|
})]
|
|
468
464
|
}), loading ? /*#__PURE__*/_jsx(PickersCalendarLoadingContainer, {
|
|
469
465
|
className: classes.loadingContainer,
|