@mui/x-date-pickers 8.9.2 → 8.10.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.
Files changed (30) hide show
  1. package/AdapterDateFns/AdapterDateFns.js +194 -193
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.js +57 -60
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +197 -196
  4. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +195 -195
  5. package/AdapterDateFnsV2/AdapterDateFnsV2.js +192 -192
  6. package/AdapterDayjs/AdapterDayjs.js +378 -378
  7. package/AdapterLuxon/AdapterLuxon.js +324 -324
  8. package/AdapterMoment/AdapterMoment.js +297 -300
  9. package/AdapterMomentHijri/AdapterMomentHijri.js +78 -77
  10. package/AdapterMomentJalaali/AdapterMomentJalaali.js +78 -79
  11. package/CHANGELOG.md +303 -6
  12. package/PickersLayout/PickersLayout.js +12 -9
  13. package/PickersLayout/PickersLayout.types.d.ts +5 -0
  14. package/PickersLayout/usePickerLayout.js +6 -2
  15. package/esm/AdapterDateFns/AdapterDateFns.js +194 -193
  16. package/esm/AdapterDateFnsBase/AdapterDateFnsBase.js +57 -60
  17. package/esm/AdapterDateFnsJalali/AdapterDateFnsJalali.js +197 -196
  18. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +195 -195
  19. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +192 -192
  20. package/esm/AdapterDayjs/AdapterDayjs.js +378 -378
  21. package/esm/AdapterLuxon/AdapterLuxon.js +324 -324
  22. package/esm/AdapterMoment/AdapterMoment.js +297 -300
  23. package/esm/AdapterMomentHijri/AdapterMomentHijri.js +78 -77
  24. package/esm/AdapterMomentJalaali/AdapterMomentJalaali.js +78 -79
  25. package/esm/PickersLayout/PickersLayout.js +12 -9
  26. package/esm/PickersLayout/PickersLayout.types.d.ts +5 -0
  27. package/esm/PickersLayout/usePickerLayout.js +6 -2
  28. package/esm/index.js +1 -1
  29. package/index.js +1 -1
  30. package/package.json +7 -9
@@ -127,201 +127,202 @@ export class AdapterDateFnsJalali extends AdapterDateFnsBase {
127
127
  longFormatters,
128
128
  lib: 'date-fns-jalali'
129
129
  });
130
- // TODO: explicit return types can be removed once there is only one date-fns version supported
131
- this.parse = (value, format) => {
132
- if (value === '') {
133
- return null;
134
- }
135
- return dateFnsParse(value, format, new Date(), {
136
- locale: this.locale
137
- });
138
- };
139
- this.isValid = value => {
140
- if (value == null) {
141
- return false;
142
- }
143
- return isValid(value);
144
- };
145
- this.format = (value, formatKey) => {
146
- return this.formatByString(value, this.formats[formatKey]);
147
- };
148
- this.formatByString = (value, formatString) => {
149
- return dateFnsFormat(value, formatString, {
150
- locale: this.locale
151
- });
152
- };
153
- this.formatNumber = numberToFormat => {
154
- return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
155
- };
156
- this.isEqual = (value, comparing) => {
157
- if (value === null && comparing === null) {
158
- return true;
159
- }
160
- if (value === null || comparing === null) {
161
- return false;
162
- }
163
- return isEqual(value, comparing);
164
- };
165
- this.isSameYear = (value, comparing) => {
166
- return isSameYear(value, comparing);
167
- };
168
- this.isSameMonth = (value, comparing) => {
169
- return isSameMonth(value, comparing);
170
- };
171
- this.isSameDay = (value, comparing) => {
172
- return isSameDay(value, comparing);
173
- };
174
- this.isSameHour = (value, comparing) => {
175
- return isSameHour(value, comparing);
176
- };
177
- this.isAfter = (value, comparing) => {
178
- return isAfter(value, comparing);
179
- };
180
- this.isAfterYear = (value, comparing) => {
181
- return isAfter(value, this.endOfYear(comparing));
182
- };
183
- this.isAfterDay = (value, comparing) => {
184
- return isAfter(value, this.endOfDay(comparing));
185
- };
186
- this.isBefore = (value, comparing) => {
187
- return isBefore(value, comparing);
188
- };
189
- this.isBeforeYear = (value, comparing) => {
190
- return isBefore(value, this.startOfYear(comparing));
191
- };
192
- this.isBeforeDay = (value, comparing) => {
193
- return isBefore(value, this.startOfDay(comparing));
194
- };
195
- this.isWithinRange = (value, [start, end]) => {
196
- return isWithinInterval(value, {
197
- start,
198
- end
199
- });
200
- };
201
- this.startOfYear = value => {
202
- return startOfYear(value);
203
- };
204
- this.startOfMonth = value => {
205
- return startOfMonth(value);
206
- };
207
- this.startOfWeek = value => {
208
- return startOfWeek(value, {
209
- locale: this.locale
210
- });
211
- };
212
- this.startOfDay = value => {
213
- return startOfDay(value);
214
- };
215
- this.endOfYear = value => {
216
- return endOfYear(value);
217
- };
218
- this.endOfMonth = value => {
219
- return endOfMonth(value);
220
- };
221
- this.endOfWeek = value => {
222
- return endOfWeek(value, {
223
- locale: this.locale
224
- });
225
- };
226
- this.endOfDay = value => {
227
- return endOfDay(value);
228
- };
229
- this.addYears = (value, amount) => {
230
- return addYears(value, amount);
231
- };
232
- this.addMonths = (value, amount) => {
233
- return addMonths(value, amount);
234
- };
235
- this.addWeeks = (value, amount) => {
236
- return addWeeks(value, amount);
237
- };
238
- this.addDays = (value, amount) => {
239
- return addDays(value, amount);
240
- };
241
- this.addHours = (value, amount) => {
242
- return addHours(value, amount);
243
- };
244
- this.addMinutes = (value, amount) => {
245
- return addMinutes(value, amount);
246
- };
247
- this.addSeconds = (value, amount) => {
248
- return addSeconds(value, amount);
249
- };
250
- this.getYear = value => {
251
- return getYear(value);
252
- };
253
- this.getMonth = value => {
254
- return getMonth(value);
255
- };
256
- this.getDate = value => {
257
- return getDate(value);
258
- };
259
- this.getHours = value => {
260
- return getHours(value);
261
- };
262
- this.getMinutes = value => {
263
- return getMinutes(value);
264
- };
265
- this.getSeconds = value => {
266
- return getSeconds(value);
267
- };
268
- this.getMilliseconds = value => {
269
- return getMilliseconds(value);
270
- };
271
- this.setYear = (value, year) => {
272
- return setYear(value, year);
273
- };
274
- this.setMonth = (value, month) => {
275
- return setMonth(value, month);
276
- };
277
- this.setDate = (value, date) => {
278
- return setDate(value, date);
279
- };
280
- this.setHours = (value, hours) => {
281
- return setHours(value, hours);
282
- };
283
- this.setMinutes = (value, minutes) => {
284
- return setMinutes(value, minutes);
285
- };
286
- this.setSeconds = (value, seconds) => {
287
- return setSeconds(value, seconds);
288
- };
289
- this.setMilliseconds = (value, milliseconds) => {
290
- return setMilliseconds(value, milliseconds);
291
- };
292
- this.getDaysInMonth = value => {
293
- return getDaysInMonth(value);
294
- };
295
- this.getWeekArray = value => {
296
- const start = this.startOfWeek(this.startOfMonth(value));
297
- const end = this.endOfWeek(this.endOfMonth(value));
298
- let count = 0;
299
- let current = start;
300
- const nestedWeeks = [];
301
- while (this.isBefore(current, end)) {
302
- const weekNumber = Math.floor(count / 7);
303
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
304
- nestedWeeks[weekNumber].push(current);
305
- current = this.addDays(current, 1);
306
- count += 1;
307
- }
308
- return nestedWeeks;
309
- };
310
- this.getWeekNumber = date => {
311
- return getWeek(date, {
312
- locale: this.locale
313
- });
314
- };
315
- this.getYearRange = ([start, end]) => {
316
- const startDate = this.startOfYear(start);
317
- const endDate = this.endOfYear(end);
318
- const years = [];
319
- let current = startDate;
320
- while (this.isBefore(current, endDate)) {
321
- years.push(current);
322
- current = this.addYears(current, 1);
323
- }
324
- return years;
325
- };
326
130
  }
131
+
132
+ // TODO: explicit return types can be removed once there is only one date-fns version supported
133
+ parse = (value, format) => {
134
+ if (value === '') {
135
+ return null;
136
+ }
137
+ return dateFnsParse(value, format, new Date(), {
138
+ locale: this.locale
139
+ });
140
+ };
141
+ isValid = value => {
142
+ if (value == null) {
143
+ return false;
144
+ }
145
+ return isValid(value);
146
+ };
147
+ format = (value, formatKey) => {
148
+ return this.formatByString(value, this.formats[formatKey]);
149
+ };
150
+ formatByString = (value, formatString) => {
151
+ return dateFnsFormat(value, formatString, {
152
+ locale: this.locale
153
+ });
154
+ };
155
+ formatNumber = numberToFormat => {
156
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
157
+ };
158
+ isEqual = (value, comparing) => {
159
+ if (value === null && comparing === null) {
160
+ return true;
161
+ }
162
+ if (value === null || comparing === null) {
163
+ return false;
164
+ }
165
+ return isEqual(value, comparing);
166
+ };
167
+ isSameYear = (value, comparing) => {
168
+ return isSameYear(value, comparing);
169
+ };
170
+ isSameMonth = (value, comparing) => {
171
+ return isSameMonth(value, comparing);
172
+ };
173
+ isSameDay = (value, comparing) => {
174
+ return isSameDay(value, comparing);
175
+ };
176
+ isSameHour = (value, comparing) => {
177
+ return isSameHour(value, comparing);
178
+ };
179
+ isAfter = (value, comparing) => {
180
+ return isAfter(value, comparing);
181
+ };
182
+ isAfterYear = (value, comparing) => {
183
+ return isAfter(value, this.endOfYear(comparing));
184
+ };
185
+ isAfterDay = (value, comparing) => {
186
+ return isAfter(value, this.endOfDay(comparing));
187
+ };
188
+ isBefore = (value, comparing) => {
189
+ return isBefore(value, comparing);
190
+ };
191
+ isBeforeYear = (value, comparing) => {
192
+ return isBefore(value, this.startOfYear(comparing));
193
+ };
194
+ isBeforeDay = (value, comparing) => {
195
+ return isBefore(value, this.startOfDay(comparing));
196
+ };
197
+ isWithinRange = (value, [start, end]) => {
198
+ return isWithinInterval(value, {
199
+ start,
200
+ end
201
+ });
202
+ };
203
+ startOfYear = value => {
204
+ return startOfYear(value);
205
+ };
206
+ startOfMonth = value => {
207
+ return startOfMonth(value);
208
+ };
209
+ startOfWeek = value => {
210
+ return startOfWeek(value, {
211
+ locale: this.locale
212
+ });
213
+ };
214
+ startOfDay = value => {
215
+ return startOfDay(value);
216
+ };
217
+ endOfYear = value => {
218
+ return endOfYear(value);
219
+ };
220
+ endOfMonth = value => {
221
+ return endOfMonth(value);
222
+ };
223
+ endOfWeek = value => {
224
+ return endOfWeek(value, {
225
+ locale: this.locale
226
+ });
227
+ };
228
+ endOfDay = value => {
229
+ return endOfDay(value);
230
+ };
231
+ addYears = (value, amount) => {
232
+ return addYears(value, amount);
233
+ };
234
+ addMonths = (value, amount) => {
235
+ return addMonths(value, amount);
236
+ };
237
+ addWeeks = (value, amount) => {
238
+ return addWeeks(value, amount);
239
+ };
240
+ addDays = (value, amount) => {
241
+ return addDays(value, amount);
242
+ };
243
+ addHours = (value, amount) => {
244
+ return addHours(value, amount);
245
+ };
246
+ addMinutes = (value, amount) => {
247
+ return addMinutes(value, amount);
248
+ };
249
+ addSeconds = (value, amount) => {
250
+ return addSeconds(value, amount);
251
+ };
252
+ getYear = value => {
253
+ return getYear(value);
254
+ };
255
+ getMonth = value => {
256
+ return getMonth(value);
257
+ };
258
+ getDate = value => {
259
+ return getDate(value);
260
+ };
261
+ getHours = value => {
262
+ return getHours(value);
263
+ };
264
+ getMinutes = value => {
265
+ return getMinutes(value);
266
+ };
267
+ getSeconds = value => {
268
+ return getSeconds(value);
269
+ };
270
+ getMilliseconds = value => {
271
+ return getMilliseconds(value);
272
+ };
273
+ setYear = (value, year) => {
274
+ return setYear(value, year);
275
+ };
276
+ setMonth = (value, month) => {
277
+ return setMonth(value, month);
278
+ };
279
+ setDate = (value, date) => {
280
+ return setDate(value, date);
281
+ };
282
+ setHours = (value, hours) => {
283
+ return setHours(value, hours);
284
+ };
285
+ setMinutes = (value, minutes) => {
286
+ return setMinutes(value, minutes);
287
+ };
288
+ setSeconds = (value, seconds) => {
289
+ return setSeconds(value, seconds);
290
+ };
291
+ setMilliseconds = (value, milliseconds) => {
292
+ return setMilliseconds(value, milliseconds);
293
+ };
294
+ getDaysInMonth = value => {
295
+ return getDaysInMonth(value);
296
+ };
297
+ getWeekArray = value => {
298
+ const start = this.startOfWeek(this.startOfMonth(value));
299
+ const end = this.endOfWeek(this.endOfMonth(value));
300
+ let count = 0;
301
+ let current = start;
302
+ const nestedWeeks = [];
303
+ while (this.isBefore(current, end)) {
304
+ const weekNumber = Math.floor(count / 7);
305
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
306
+ nestedWeeks[weekNumber].push(current);
307
+ current = this.addDays(current, 1);
308
+ count += 1;
309
+ }
310
+ return nestedWeeks;
311
+ };
312
+ getWeekNumber = date => {
313
+ return getWeek(date, {
314
+ locale: this.locale
315
+ });
316
+ };
317
+ getYearRange = ([start, end]) => {
318
+ const startDate = this.startOfYear(start);
319
+ const endDate = this.endOfYear(end);
320
+ const years = [];
321
+ let current = startDate;
322
+ while (this.isBefore(current, endDate)) {
323
+ years.push(current);
324
+ current = this.addYears(current, 1);
325
+ }
326
+ return years;
327
+ };
327
328
  }