@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
package/models/adapters.d.ts
CHANGED
|
@@ -61,12 +61,6 @@ export interface AdapterFormats {
|
|
|
61
61
|
* @example "Jan 1, 2019"
|
|
62
62
|
*/
|
|
63
63
|
fullDate: string;
|
|
64
|
-
/**
|
|
65
|
-
* The partially localized full date with weekday, useful for text-to-speech accessibility.
|
|
66
|
-
* @example "Tuesday, January 1, 2019"
|
|
67
|
-
* @deprecated Never used internally.
|
|
68
|
-
*/
|
|
69
|
-
fullDateWithWeekday: string;
|
|
70
64
|
/**
|
|
71
65
|
* A keyboard input friendly date format.
|
|
72
66
|
* Used in the date fields.
|
|
@@ -91,18 +85,6 @@ export interface AdapterFormats {
|
|
|
91
85
|
* @example "Sun, Jan 1"
|
|
92
86
|
*/
|
|
93
87
|
normalDateWithWeekday: string;
|
|
94
|
-
/**
|
|
95
|
-
* The month name and the 4-digit year.
|
|
96
|
-
* @example "January 2018"
|
|
97
|
-
* @deprecated Use `${adapter.formats.month} ${adapter.formats.year}`
|
|
98
|
-
*/
|
|
99
|
-
monthAndYear: string;
|
|
100
|
-
/**
|
|
101
|
-
* The month name and the day of the month.
|
|
102
|
-
* @example "January 1"
|
|
103
|
-
* @deprecated Use `${adapter.formats.month} ${adapter.formats.dayOfMonth}`
|
|
104
|
-
*/
|
|
105
|
-
monthAndDate: string;
|
|
106
88
|
/**
|
|
107
89
|
* The hours and the minutes.
|
|
108
90
|
* Used for the aria-label of the opening button of the `TimePicker`.
|
|
@@ -119,24 +101,6 @@ export interface AdapterFormats {
|
|
|
119
101
|
* @example "23:44"
|
|
120
102
|
*/
|
|
121
103
|
fullTime24h: string;
|
|
122
|
-
/**
|
|
123
|
-
* The combination of `fullDate` and `fullTime` formats.
|
|
124
|
-
* @example "Jan 1, 2018 11:44 PM"
|
|
125
|
-
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime}`
|
|
126
|
-
*/
|
|
127
|
-
fullDateTime: string;
|
|
128
|
-
/**
|
|
129
|
-
* The combination of `fullDate` and `fullTime12h` formats.
|
|
130
|
-
* @example "Jan 1, 2018 11:44 PM"
|
|
131
|
-
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime12h}`
|
|
132
|
-
*/
|
|
133
|
-
fullDateTime12h: string;
|
|
134
|
-
/**
|
|
135
|
-
* The combination of `fullDate` and `fullTime24h` formats.
|
|
136
|
-
* @example "Jan 1, 2018 23:44"
|
|
137
|
-
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime24h}`
|
|
138
|
-
*/
|
|
139
|
-
fullDateTime24h: string;
|
|
140
104
|
/**
|
|
141
105
|
* A keyboard input friendly time format.
|
|
142
106
|
* Used in the date-time fields.
|
|
@@ -156,7 +120,6 @@ export interface AdapterFormats {
|
|
|
156
120
|
*/
|
|
157
121
|
keyboardDateTime24h: string;
|
|
158
122
|
}
|
|
159
|
-
export type AdapterUnits = 'years' | 'quarters' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds';
|
|
160
123
|
export type FieldFormatTokenMap = {
|
|
161
124
|
[formatToken: string]: FieldSectionType | {
|
|
162
125
|
sectionType: FieldSectionType;
|
|
@@ -200,20 +163,16 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
200
163
|
* If no `value` parameter is provided, creates a date with the current timestamp.
|
|
201
164
|
* If a `value` parameter is provided, pass it to the date library to try to parse it.
|
|
202
165
|
* @template TDate
|
|
203
|
-
* @param {
|
|
166
|
+
* @param {string | null | undefined} value The optional value to parse.
|
|
167
|
+
* @param {PickersTimezone} timezone The timezone of the date. Default: "default"
|
|
204
168
|
* @returns {TDate | null} The parsed date.
|
|
205
169
|
*/
|
|
206
|
-
date(value?:
|
|
170
|
+
date<T extends string | null | undefined>(value?: T, timezone?: PickersTimezone): DateBuilderReturnType<T, TDate>;
|
|
207
171
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* If a `value` parameter is provided, pass it to the date library to try to parse it.
|
|
211
|
-
* @template TDate
|
|
212
|
-
* @param {string | null | undefined} value The optional value to parse.
|
|
213
|
-
* @param {PickersTimezone} timezone The timezone of the date.
|
|
214
|
-
* @returns {TDate | null} The parsed date.
|
|
172
|
+
* Creates an invalid date in the date library format.
|
|
173
|
+
* @returns {TDate} The invalid date.
|
|
215
174
|
*/
|
|
216
|
-
|
|
175
|
+
getInvalidDate(): TDate;
|
|
217
176
|
/**
|
|
218
177
|
* Extracts the timezone from a date.
|
|
219
178
|
* @template TDate
|
|
@@ -235,22 +194,6 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
235
194
|
* @returns {Date} the JavaScript date.
|
|
236
195
|
*/
|
|
237
196
|
toJsDate(value: TDate): Date;
|
|
238
|
-
/**
|
|
239
|
-
* Parse an iso string into a date in the date library format.
|
|
240
|
-
* @deprecate Will be removed in v7.
|
|
241
|
-
* @template TDate
|
|
242
|
-
* @param {string} isoString The iso string to parse.
|
|
243
|
-
* @returns {TDate} the parsed date.
|
|
244
|
-
*/
|
|
245
|
-
parseISO(isoString: string): TDate;
|
|
246
|
-
/**
|
|
247
|
-
* Stringify a date in the date library format into an ISO string.
|
|
248
|
-
* @deprecate Will be removed in v7.
|
|
249
|
-
* @template TDate
|
|
250
|
-
* @param {TDate} value The date to stringify.
|
|
251
|
-
* @returns {string} the iso string representing the date.
|
|
252
|
-
*/
|
|
253
|
-
toISO(value: TDate): string;
|
|
254
197
|
/**
|
|
255
198
|
* Parse a string date in a specific format.
|
|
256
199
|
* @template TDate
|
|
@@ -275,27 +218,12 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
275
218
|
* @returns {string} The expanded format.
|
|
276
219
|
*/
|
|
277
220
|
expandFormat(format: string): string;
|
|
278
|
-
/**
|
|
279
|
-
* Create a user readable format (taking into account localized format tokens), useful to render helper text for input (e.g. placeholder).
|
|
280
|
-
* @deprecated Will be removed in v7.
|
|
281
|
-
* @param {string} format The format to analyze.
|
|
282
|
-
* @returns {string} The helper text of the given format.
|
|
283
|
-
*/
|
|
284
|
-
getFormatHelperText(format: string): string;
|
|
285
|
-
/**
|
|
286
|
-
* Check if the date is null.
|
|
287
|
-
* @deprecated Will be removed in v7.
|
|
288
|
-
* @template TDate
|
|
289
|
-
* @param {TDate | null} value The date to test.
|
|
290
|
-
* @returns {boolean} `true` if the date is null.
|
|
291
|
-
*/
|
|
292
|
-
isNull(value: TDate | null): boolean;
|
|
293
221
|
/**
|
|
294
222
|
* Check if the date is valid.
|
|
295
|
-
* @param {
|
|
296
|
-
* @returns {boolean} `true` if the value is valid.
|
|
223
|
+
* @param {TDate | null} value The value to test.
|
|
224
|
+
* @returns {boolean} `true` if the value is a valid date according to the date library.
|
|
297
225
|
*/
|
|
298
|
-
isValid(value:
|
|
226
|
+
isValid(value: TDate | null): boolean;
|
|
299
227
|
/**
|
|
300
228
|
* Format a date using an adapter format string (see the `AdapterFormats` interface)
|
|
301
229
|
* @template TDate
|
|
@@ -319,23 +247,13 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
319
247
|
* @returns {string} The formatted number.
|
|
320
248
|
*/
|
|
321
249
|
formatNumber(numberToFormat: string): string;
|
|
322
|
-
/**
|
|
323
|
-
* Compute the difference between the two dates in the unit provided.
|
|
324
|
-
* @deprecated Will be removed in v7.
|
|
325
|
-
* @template TDate
|
|
326
|
-
* @param {TDate} value The reference date.
|
|
327
|
-
* @param {TDate | string} comparing The date to compare with the reference date.
|
|
328
|
-
* @param {AdapterUnits} unit The unit in which we want to the result to be.
|
|
329
|
-
* @returns {number} The diff between the two dates.
|
|
330
|
-
*/
|
|
331
|
-
getDiff(value: TDate, comparing: TDate | string, unit?: AdapterUnits): number;
|
|
332
250
|
/**
|
|
333
251
|
* Check if the two dates are equal (e.g: they represent the same timestamp).
|
|
334
|
-
* @param {
|
|
335
|
-
* @param {
|
|
252
|
+
* @param {TDate | null} value The reference date.
|
|
253
|
+
* @param {TDate | null} comparing The date to compare with the reference date.
|
|
336
254
|
* @returns {boolean} `true` if the two dates are equal.
|
|
337
255
|
*/
|
|
338
|
-
isEqual(value:
|
|
256
|
+
isEqual(value: TDate | null, comparing: TDate | null): boolean;
|
|
339
257
|
/**
|
|
340
258
|
* Check if the two dates are in the same year (using the timezone of the reference date).
|
|
341
259
|
* @template TDate
|
|
@@ -417,7 +335,7 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
417
335
|
*/
|
|
418
336
|
isBeforeDay(value: TDate, comparing: TDate): boolean;
|
|
419
337
|
/**
|
|
420
|
-
* Check if the value is
|
|
338
|
+
* Check if the value is within the provided range.
|
|
421
339
|
* @template TDate
|
|
422
340
|
* @param {TDate} value The value to test.
|
|
423
341
|
* @param {[TDate, TDate]} range The range in which the value should be.
|
|
@@ -649,45 +567,6 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
649
567
|
* @returns {number} The number of days in the month
|
|
650
568
|
*/
|
|
651
569
|
getDaysInMonth(value: TDate): number;
|
|
652
|
-
/**
|
|
653
|
-
* Add one month to the given date.
|
|
654
|
-
* @deprecated Use `addMonths(value, 1)`
|
|
655
|
-
* @template TDate
|
|
656
|
-
* @param {TDate} value The given date.
|
|
657
|
-
* @returns {TDate} The new date with one month added.
|
|
658
|
-
*/
|
|
659
|
-
getNextMonth(value: TDate): TDate;
|
|
660
|
-
/**
|
|
661
|
-
* Subtract one month from the given date.
|
|
662
|
-
* @deprecated Use `addMonths(value, -1)`
|
|
663
|
-
* @template TDate
|
|
664
|
-
* @param {TDate} value The given date.
|
|
665
|
-
* @returns {TDate} The new date with one month subtracted.
|
|
666
|
-
*/
|
|
667
|
-
getPreviousMonth(value: TDate): TDate;
|
|
668
|
-
/**
|
|
669
|
-
* Get an array with all the months in the year of the given date.
|
|
670
|
-
* @deprecated Will be removed in v7.
|
|
671
|
-
* @template TDate
|
|
672
|
-
* @param {TDate} value The given date.
|
|
673
|
-
* @returns {TDate[]} All the months in the year of the given date.
|
|
674
|
-
*/
|
|
675
|
-
getMonthArray(value: TDate): TDate[];
|
|
676
|
-
/**
|
|
677
|
-
* Create a date with the date of the first param and the time of the second param.
|
|
678
|
-
* @deprecated Use `adapter.setHours`, `adapter.setMinutes` and `adapter.setSeconds`.
|
|
679
|
-
* @template TDate
|
|
680
|
-
* @param {TDate} dateParam Param from which we want to get the date.
|
|
681
|
-
* @param {TDate} timeParam Param from which we want to get the time.
|
|
682
|
-
* @returns Date with the date of the first param and the time of the second param.
|
|
683
|
-
*/
|
|
684
|
-
mergeDateAndTime(dateParam: TDate, timeParam: TDate): TDate;
|
|
685
|
-
/**
|
|
686
|
-
* Get the label of each day of a week.
|
|
687
|
-
* @deprecated Will be removed in v7. Use `getWeekdays` from date-utils and format the dates.
|
|
688
|
-
* @returns {string[]} The label of each day of a week.
|
|
689
|
-
*/
|
|
690
|
-
getWeekdays(): string[];
|
|
691
570
|
/**
|
|
692
571
|
* Create a nested list with all the days of the month of the given date grouped by week.
|
|
693
572
|
* @template TDate
|
|
@@ -703,19 +582,11 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
703
582
|
*/
|
|
704
583
|
getWeekNumber(value: TDate): number;
|
|
705
584
|
/**
|
|
706
|
-
* Create a list with all the years between the start
|
|
585
|
+
* Create a list with all the years between the start and the end date.
|
|
707
586
|
* @template TDate
|
|
708
|
-
* @param {TDate}
|
|
709
|
-
* @param {TDate} end The end of the range.
|
|
587
|
+
* @param {[TDate, TDate]} range The range of year to create.
|
|
710
588
|
* @returns {TDate[]} List of all the years between the start end the end date.
|
|
711
589
|
*/
|
|
712
|
-
getYearRange(
|
|
713
|
-
/**
|
|
714
|
-
* Allow to customize how the "am"` and "pm" strings are rendered.
|
|
715
|
-
* @deprecated Use `utils.format(utils.setHours(utils.date()!, meridiem === 'am' ? 2 : 14), 'meridiem')` instead.
|
|
716
|
-
* @param {"am" | "pm"} meridiem The string to render.
|
|
717
|
-
* @return {string} The formatted string.
|
|
718
|
-
*/
|
|
719
|
-
getMeridiemText(meridiem: 'am' | 'pm'): string;
|
|
590
|
+
getYearRange(range: [TDate, TDate]): TDate[];
|
|
720
591
|
}
|
|
721
592
|
export {};
|
package/models/fields.d.ts
CHANGED
|
@@ -32,12 +32,6 @@ export interface FieldSection {
|
|
|
32
32
|
* Will determine if we should apply a digit-based editing or a letter-based editing.
|
|
33
33
|
*/
|
|
34
34
|
contentType: FieldSectionContentType;
|
|
35
|
-
/**
|
|
36
|
-
* If `true`, the value of this section is supposed to have leading zeroes when parsed by the date library.
|
|
37
|
-
* For example, the value `1` should be rendered as "01" instead of "1".
|
|
38
|
-
* @deprecated Will be removed in v7, use `hasLeadingZerosInFormat` instead.
|
|
39
|
-
*/
|
|
40
|
-
hasLeadingZeros: boolean;
|
|
41
35
|
/**
|
|
42
36
|
* If `true`, the value of this section is supposed to have leading zeroes when parsed by the date library.
|
|
43
37
|
* For example, the value `1` should be rendered as "01" instead of "1".
|
package/models/timezone.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface TimezoneProps {
|
|
|
4
4
|
* Choose which timezone to use for the value.
|
|
5
5
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
6
6
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
7
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
7
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
8
8
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
9
9
|
*/
|
|
10
10
|
timezone?: PickersTimezone;
|
package/models/validation.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
type CommonDateTimeValidationError = 'invalidDate' | 'disableFuture' | 'disablePast' | null;
|
|
5
5
|
export type DateValidationError = CommonDateTimeValidationError | 'shouldDisableDate' | 'shouldDisableMonth' | 'shouldDisableYear' | 'minDate' | 'maxDate';
|
|
6
|
-
export type TimeValidationError = CommonDateTimeValidationError | 'minutesStep' | 'minTime' | 'maxTime' | '
|
|
6
|
+
export type TimeValidationError = CommonDateTimeValidationError | 'minutesStep' | 'minTime' | 'maxTime' | 'shouldDisableTime-hours' | 'shouldDisableTime-minutes' | 'shouldDisableTime-seconds';
|
|
7
7
|
export type DateTimeValidationError = DateValidationError | TimeValidationError;
|
|
8
8
|
export {};
|
|
@@ -7,16 +7,6 @@ import addHours from 'date-fns/addHours';
|
|
|
7
7
|
import addWeeks from 'date-fns/addWeeks';
|
|
8
8
|
import addMonths from 'date-fns/addMonths';
|
|
9
9
|
import addYears from 'date-fns/addYears';
|
|
10
|
-
import differenceInYears from 'date-fns/differenceInYears';
|
|
11
|
-
import differenceInQuarters from 'date-fns/differenceInQuarters';
|
|
12
|
-
import differenceInMonths from 'date-fns/differenceInMonths';
|
|
13
|
-
import differenceInWeeks from 'date-fns/differenceInWeeks';
|
|
14
|
-
import differenceInDays from 'date-fns/differenceInDays';
|
|
15
|
-
import differenceInHours from 'date-fns/differenceInHours';
|
|
16
|
-
import differenceInMinutes from 'date-fns/differenceInMinutes';
|
|
17
|
-
import differenceInSeconds from 'date-fns/differenceInSeconds';
|
|
18
|
-
import differenceInMilliseconds from 'date-fns/differenceInMilliseconds';
|
|
19
|
-
import eachDayOfInterval from 'date-fns/eachDayOfInterval';
|
|
20
10
|
import endOfDay from 'date-fns/endOfDay';
|
|
21
11
|
import endOfWeek from 'date-fns/endOfWeek';
|
|
22
12
|
import endOfYear from 'date-fns/endOfYear';
|
|
@@ -51,8 +41,6 @@ import startOfMonth from 'date-fns/startOfMonth';
|
|
|
51
41
|
import endOfMonth from 'date-fns/endOfMonth';
|
|
52
42
|
import startOfWeek from 'date-fns/startOfWeek';
|
|
53
43
|
import startOfYear from 'date-fns/startOfYear';
|
|
54
|
-
import parseISO from 'date-fns/parseISO';
|
|
55
|
-
import formatISO from 'date-fns/formatISO';
|
|
56
44
|
import isWithinInterval from 'date-fns/isWithinInterval';
|
|
57
45
|
import defaultLocale from 'date-fns/locale/en-US';
|
|
58
46
|
// @ts-ignore
|
|
@@ -235,19 +223,13 @@ const defaultFormats = {
|
|
|
235
223
|
minutes: 'mm',
|
|
236
224
|
seconds: 'ss',
|
|
237
225
|
fullDate: 'PP',
|
|
238
|
-
fullDateWithWeekday: 'PPPP',
|
|
239
226
|
keyboardDate: 'P',
|
|
240
227
|
shortDate: 'MMM d',
|
|
241
228
|
normalDate: 'd MMMM',
|
|
242
229
|
normalDateWithWeekday: 'EEE, MMM d',
|
|
243
|
-
monthAndYear: 'LLLL yyyy',
|
|
244
|
-
monthAndDate: 'MMMM d',
|
|
245
230
|
fullTime: 'p',
|
|
246
231
|
fullTime12h: 'hh:mm aa',
|
|
247
232
|
fullTime24h: 'HH:mm',
|
|
248
|
-
fullDateTime: 'PP p',
|
|
249
|
-
fullDateTime12h: 'PP hh:mm aa',
|
|
250
|
-
fullDateTime24h: 'PP HH:mm',
|
|
251
233
|
keyboardDateTime: 'P p',
|
|
252
234
|
keyboardDateTime12h: 'P hh:mm aa',
|
|
253
235
|
keyboardDateTime24h: 'P HH:mm'
|
|
@@ -302,9 +284,7 @@ export class AdapterDateFns {
|
|
|
302
284
|
}
|
|
303
285
|
return new Date(value);
|
|
304
286
|
};
|
|
305
|
-
this.
|
|
306
|
-
return this.date(value);
|
|
307
|
-
};
|
|
287
|
+
this.getInvalidDate = () => new Date('Invalid Date');
|
|
308
288
|
this.getTimezone = () => {
|
|
309
289
|
return 'default';
|
|
310
290
|
};
|
|
@@ -314,14 +294,6 @@ export class AdapterDateFns {
|
|
|
314
294
|
this.toJsDate = value => {
|
|
315
295
|
return value;
|
|
316
296
|
};
|
|
317
|
-
this.parseISO = isoString => {
|
|
318
|
-
return parseISO(isoString);
|
|
319
|
-
};
|
|
320
|
-
this.toISO = value => {
|
|
321
|
-
return formatISO(value, {
|
|
322
|
-
format: 'extended'
|
|
323
|
-
});
|
|
324
|
-
};
|
|
325
297
|
this.parse = (value, format) => {
|
|
326
298
|
if (value === '') {
|
|
327
299
|
return null;
|
|
@@ -357,14 +329,11 @@ export class AdapterDateFns {
|
|
|
357
329
|
return token;
|
|
358
330
|
}).join('');
|
|
359
331
|
};
|
|
360
|
-
this.getFormatHelperText = format => {
|
|
361
|
-
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
362
|
-
};
|
|
363
|
-
this.isNull = value => {
|
|
364
|
-
return value === null;
|
|
365
|
-
};
|
|
366
332
|
this.isValid = value => {
|
|
367
|
-
|
|
333
|
+
if (value == null) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
return isValid(value);
|
|
368
337
|
};
|
|
369
338
|
this.format = (value, formatKey) => {
|
|
370
339
|
return this.formatByString(value, this.formats[formatKey]);
|
|
@@ -377,34 +346,13 @@ export class AdapterDateFns {
|
|
|
377
346
|
this.formatNumber = numberToFormat => {
|
|
378
347
|
return numberToFormat;
|
|
379
348
|
};
|
|
380
|
-
this.getDiff = (value, comparing, unit) => {
|
|
381
|
-
switch (unit) {
|
|
382
|
-
case 'years':
|
|
383
|
-
return differenceInYears(value, this.date(comparing));
|
|
384
|
-
case 'quarters':
|
|
385
|
-
return differenceInQuarters(value, this.date(comparing));
|
|
386
|
-
case 'months':
|
|
387
|
-
return differenceInMonths(value, this.date(comparing));
|
|
388
|
-
case 'weeks':
|
|
389
|
-
return differenceInWeeks(value, this.date(comparing));
|
|
390
|
-
case 'days':
|
|
391
|
-
return differenceInDays(value, this.date(comparing));
|
|
392
|
-
case 'hours':
|
|
393
|
-
return differenceInHours(value, this.date(comparing));
|
|
394
|
-
case 'minutes':
|
|
395
|
-
return differenceInMinutes(value, this.date(comparing));
|
|
396
|
-
case 'seconds':
|
|
397
|
-
return differenceInSeconds(value, this.date(comparing));
|
|
398
|
-
default:
|
|
399
|
-
{
|
|
400
|
-
return differenceInMilliseconds(value, this.date(comparing));
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
349
|
this.isEqual = (value, comparing) => {
|
|
405
350
|
if (value === null && comparing === null) {
|
|
406
351
|
return true;
|
|
407
352
|
}
|
|
353
|
+
if (value === null || comparing === null) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
408
356
|
return isEqual(value, comparing);
|
|
409
357
|
};
|
|
410
358
|
this.isSameYear = (value, comparing) => {
|
|
@@ -537,35 +485,6 @@ export class AdapterDateFns {
|
|
|
537
485
|
this.getDaysInMonth = value => {
|
|
538
486
|
return getDaysInMonth(value);
|
|
539
487
|
};
|
|
540
|
-
this.getNextMonth = value => {
|
|
541
|
-
return addMonths(value, 1);
|
|
542
|
-
};
|
|
543
|
-
this.getPreviousMonth = value => {
|
|
544
|
-
return addMonths(value, -1);
|
|
545
|
-
};
|
|
546
|
-
this.getMonthArray = value => {
|
|
547
|
-
const firstMonth = startOfYear(value);
|
|
548
|
-
const monthArray = [firstMonth];
|
|
549
|
-
while (monthArray.length < 12) {
|
|
550
|
-
const prevMonth = monthArray[monthArray.length - 1];
|
|
551
|
-
monthArray.push(this.getNextMonth(prevMonth));
|
|
552
|
-
}
|
|
553
|
-
return monthArray;
|
|
554
|
-
};
|
|
555
|
-
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
556
|
-
return this.setSeconds(this.setMinutes(this.setHours(dateParam, this.getHours(timeParam)), this.getMinutes(timeParam)), this.getSeconds(timeParam));
|
|
557
|
-
};
|
|
558
|
-
this.getWeekdays = () => {
|
|
559
|
-
const now = new Date();
|
|
560
|
-
return eachDayOfInterval({
|
|
561
|
-
start: startOfWeek(now, {
|
|
562
|
-
locale: this.locale
|
|
563
|
-
}),
|
|
564
|
-
end: endOfWeek(now, {
|
|
565
|
-
locale: this.locale
|
|
566
|
-
})
|
|
567
|
-
}).map(day => this.formatByString(day, 'EEEEEE'));
|
|
568
|
-
};
|
|
569
488
|
this.getWeekArray = value => {
|
|
570
489
|
const start = startOfWeek(startOfMonth(value), {
|
|
571
490
|
locale: this.locale
|
|
@@ -590,7 +509,7 @@ export class AdapterDateFns {
|
|
|
590
509
|
locale: this.locale
|
|
591
510
|
});
|
|
592
511
|
};
|
|
593
|
-
this.getYearRange = (start, end) => {
|
|
512
|
+
this.getYearRange = ([start, end]) => {
|
|
594
513
|
const startDate = startOfYear(start);
|
|
595
514
|
const endDate = endOfYear(end);
|
|
596
515
|
const years = [];
|
|
@@ -601,9 +520,6 @@ export class AdapterDateFns {
|
|
|
601
520
|
}
|
|
602
521
|
return years;
|
|
603
522
|
};
|
|
604
|
-
this.getMeridiemText = ampm => {
|
|
605
|
-
return ampm === 'am' ? 'AM' : 'PM';
|
|
606
|
-
};
|
|
607
523
|
this.locale = _locale;
|
|
608
524
|
this.formats = _extends({}, defaultFormats, formats);
|
|
609
525
|
}
|
|
@@ -7,21 +7,10 @@ import addDays from 'date-fns-jalali/addDays';
|
|
|
7
7
|
import addWeeks from 'date-fns-jalali/addWeeks';
|
|
8
8
|
import addMonths from 'date-fns-jalali/addMonths';
|
|
9
9
|
import addYears from 'date-fns-jalali/addYears';
|
|
10
|
-
import differenceInYears from 'date-fns-jalali/differenceInYears';
|
|
11
|
-
import differenceInQuarters from 'date-fns-jalali/differenceInQuarters';
|
|
12
|
-
import differenceInMonths from 'date-fns-jalali/differenceInMonths';
|
|
13
|
-
import differenceInWeeks from 'date-fns-jalali/differenceInWeeks';
|
|
14
|
-
import differenceInDays from 'date-fns-jalali/differenceInDays';
|
|
15
|
-
import differenceInHours from 'date-fns-jalali/differenceInHours';
|
|
16
|
-
import differenceInMinutes from 'date-fns-jalali/differenceInMinutes';
|
|
17
|
-
import differenceInSeconds from 'date-fns-jalali/differenceInSeconds';
|
|
18
|
-
import differenceInMilliseconds from 'date-fns-jalali/differenceInMilliseconds';
|
|
19
|
-
import eachDayOfInterval from 'date-fns-jalali/eachDayOfInterval';
|
|
20
10
|
import endOfDay from 'date-fns-jalali/endOfDay';
|
|
21
11
|
import endOfWeek from 'date-fns-jalali/endOfWeek';
|
|
22
12
|
import endOfYear from 'date-fns-jalali/endOfYear';
|
|
23
13
|
import dateFnsFormat from 'date-fns-jalali/format';
|
|
24
|
-
import formatISO from 'date-fns-jalali/formatISO';
|
|
25
14
|
import getHours from 'date-fns-jalali/getHours';
|
|
26
15
|
import getSeconds from 'date-fns-jalali/getSeconds';
|
|
27
16
|
import getMilliseconds from 'date-fns-jalali/getMilliseconds';
|
|
@@ -40,7 +29,6 @@ import isSameMonth from 'date-fns-jalali/isSameMonth';
|
|
|
40
29
|
import isSameHour from 'date-fns-jalali/isSameHour';
|
|
41
30
|
import isValid from 'date-fns-jalali/isValid';
|
|
42
31
|
import dateFnsParse from 'date-fns-jalali/parse';
|
|
43
|
-
import parseISO from 'date-fns-jalali/parseISO';
|
|
44
32
|
import setDate from 'date-fns-jalali/setDate';
|
|
45
33
|
import setHours from 'date-fns-jalali/setHours';
|
|
46
34
|
import setMinutes from 'date-fns-jalali/setMinutes';
|
|
@@ -235,16 +223,10 @@ const defaultFormats = {
|
|
|
235
223
|
minutes: 'mm',
|
|
236
224
|
seconds: 'ss',
|
|
237
225
|
fullDate: 'PPP',
|
|
238
|
-
fullDateWithWeekday: 'PPPP',
|
|
239
226
|
keyboardDate: 'P',
|
|
240
227
|
shortDate: 'd MMM',
|
|
241
228
|
normalDate: 'd MMMM',
|
|
242
229
|
normalDateWithWeekday: 'EEE, d MMMM',
|
|
243
|
-
monthAndYear: 'LLLL yyyy',
|
|
244
|
-
monthAndDate: 'd MMMM',
|
|
245
|
-
fullDateTime: 'PPP p',
|
|
246
|
-
fullDateTime12h: 'PPP hh:mm aa',
|
|
247
|
-
fullDateTime24h: 'PPP HH:mm',
|
|
248
230
|
fullTime: 'p',
|
|
249
231
|
fullTime12h: 'hh:mm aaa',
|
|
250
232
|
fullTime24h: 'HH:mm',
|
|
@@ -314,9 +296,7 @@ export class AdapterDateFnsJalali {
|
|
|
314
296
|
}
|
|
315
297
|
return new Date(value);
|
|
316
298
|
};
|
|
317
|
-
this.
|
|
318
|
-
return this.date(value);
|
|
319
|
-
};
|
|
299
|
+
this.getInvalidDate = () => new Date('Invalid Date');
|
|
320
300
|
this.getTimezone = () => {
|
|
321
301
|
return 'default';
|
|
322
302
|
};
|
|
@@ -326,14 +306,6 @@ export class AdapterDateFnsJalali {
|
|
|
326
306
|
this.toJsDate = value => {
|
|
327
307
|
return value;
|
|
328
308
|
};
|
|
329
|
-
this.parseISO = isoString => {
|
|
330
|
-
return parseISO(isoString);
|
|
331
|
-
};
|
|
332
|
-
this.toISO = value => {
|
|
333
|
-
return formatISO(value, {
|
|
334
|
-
format: 'extended'
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
309
|
this.parse = (value, format) => {
|
|
338
310
|
if (value === '') {
|
|
339
311
|
return null;
|
|
@@ -368,14 +340,11 @@ export class AdapterDateFnsJalali {
|
|
|
368
340
|
return token;
|
|
369
341
|
}).join('');
|
|
370
342
|
};
|
|
371
|
-
this.getFormatHelperText = format => {
|
|
372
|
-
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
373
|
-
};
|
|
374
|
-
this.isNull = value => {
|
|
375
|
-
return value === null;
|
|
376
|
-
};
|
|
377
343
|
this.isValid = value => {
|
|
378
|
-
|
|
344
|
+
if (value == null) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
return isValid(value);
|
|
379
348
|
};
|
|
380
349
|
this.format = (value, formatKey) => {
|
|
381
350
|
return this.formatByString(value, this.formats[formatKey]);
|
|
@@ -388,34 +357,13 @@ export class AdapterDateFnsJalali {
|
|
|
388
357
|
this.formatNumber = numberToFormat => {
|
|
389
358
|
return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
|
|
390
359
|
};
|
|
391
|
-
this.getDiff = (value, comparing, unit) => {
|
|
392
|
-
switch (unit) {
|
|
393
|
-
case 'years':
|
|
394
|
-
return differenceInYears(value, this.date(comparing));
|
|
395
|
-
case 'quarters':
|
|
396
|
-
return differenceInQuarters(value, this.date(comparing));
|
|
397
|
-
case 'months':
|
|
398
|
-
return differenceInMonths(value, this.date(comparing));
|
|
399
|
-
case 'weeks':
|
|
400
|
-
return differenceInWeeks(value, this.date(comparing));
|
|
401
|
-
case 'days':
|
|
402
|
-
return differenceInDays(value, this.date(comparing));
|
|
403
|
-
case 'hours':
|
|
404
|
-
return differenceInHours(value, this.date(comparing));
|
|
405
|
-
case 'minutes':
|
|
406
|
-
return differenceInMinutes(value, this.date(comparing));
|
|
407
|
-
case 'seconds':
|
|
408
|
-
return differenceInSeconds(value, this.date(comparing));
|
|
409
|
-
default:
|
|
410
|
-
{
|
|
411
|
-
return differenceInMilliseconds(value, this.date(comparing));
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
360
|
this.isEqual = (value, comparing) => {
|
|
416
361
|
if (value === null && comparing === null) {
|
|
417
362
|
return true;
|
|
418
363
|
}
|
|
364
|
+
if (value === null || comparing === null) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
419
367
|
return isEqual(value, comparing);
|
|
420
368
|
};
|
|
421
369
|
this.isSameYear = (value, comparing) => {
|
|
@@ -548,35 +496,6 @@ export class AdapterDateFnsJalali {
|
|
|
548
496
|
this.getDaysInMonth = value => {
|
|
549
497
|
return getDaysInMonth(value);
|
|
550
498
|
};
|
|
551
|
-
this.getNextMonth = value => {
|
|
552
|
-
return addMonths(value, 1);
|
|
553
|
-
};
|
|
554
|
-
this.getPreviousMonth = value => {
|
|
555
|
-
return addMonths(value, -1);
|
|
556
|
-
};
|
|
557
|
-
this.getMonthArray = value => {
|
|
558
|
-
const firstMonth = startOfYear(value);
|
|
559
|
-
const monthArray = [firstMonth];
|
|
560
|
-
while (monthArray.length < 12) {
|
|
561
|
-
const prevMonth = monthArray[monthArray.length - 1];
|
|
562
|
-
monthArray.push(this.getNextMonth(prevMonth));
|
|
563
|
-
}
|
|
564
|
-
return monthArray;
|
|
565
|
-
};
|
|
566
|
-
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
567
|
-
return this.setSeconds(this.setMinutes(this.setHours(dateParam, this.getHours(timeParam)), this.getMinutes(timeParam)), this.getSeconds(timeParam));
|
|
568
|
-
};
|
|
569
|
-
this.getWeekdays = () => {
|
|
570
|
-
const now = new Date();
|
|
571
|
-
return eachDayOfInterval({
|
|
572
|
-
start: startOfWeek(now, {
|
|
573
|
-
locale: this.locale
|
|
574
|
-
}),
|
|
575
|
-
end: endOfWeek(now, {
|
|
576
|
-
locale: this.locale
|
|
577
|
-
})
|
|
578
|
-
}).map(day => this.formatByString(day, 'EEEEEE'));
|
|
579
|
-
};
|
|
580
499
|
this.getWeekArray = value => {
|
|
581
500
|
const start = startOfWeek(startOfMonth(value), {
|
|
582
501
|
locale: this.locale
|
|
@@ -601,7 +520,7 @@ export class AdapterDateFnsJalali {
|
|
|
601
520
|
locale: this.locale
|
|
602
521
|
});
|
|
603
522
|
};
|
|
604
|
-
this.getYearRange = (start, end) => {
|
|
523
|
+
this.getYearRange = ([start, end]) => {
|
|
605
524
|
const startDate = startOfYear(start);
|
|
606
525
|
const endDate = endOfYear(end);
|
|
607
526
|
const years = [];
|
|
@@ -612,9 +531,6 @@ export class AdapterDateFnsJalali {
|
|
|
612
531
|
}
|
|
613
532
|
return years;
|
|
614
533
|
};
|
|
615
|
-
this.getMeridiemText = ampm => {
|
|
616
|
-
return ampm === 'am' ? 'ق.ظ' : 'ب.ظ';
|
|
617
|
-
};
|
|
618
534
|
this.locale = _locale;
|
|
619
535
|
this.formats = _extends({}, defaultFormats, formats);
|
|
620
536
|
}
|