@mui/x-date-pickers 6.18.6 → 6.19.0

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 (72) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +3 -24
  2. package/AdapterDateFns/AdapterDateFns.js +11 -272
  3. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +65 -0
  4. package/AdapterDateFnsBase/AdapterDateFnsBase.js +308 -0
  5. package/AdapterDateFnsBase/index.d.ts +1 -0
  6. package/AdapterDateFnsBase/index.js +1 -0
  7. package/AdapterDateFnsBase/package.json +6 -0
  8. package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +88 -0
  9. package/AdapterDateFnsV3/AdapterDateFnsV3.js +357 -0
  10. package/AdapterDateFnsV3/index.d.ts +1 -0
  11. package/AdapterDateFnsV3/index.js +1 -0
  12. package/AdapterDateFnsV3/package.json +6 -0
  13. package/AdapterLuxon/AdapterLuxon.d.ts +32 -32
  14. package/CHANGELOG.md +85 -1
  15. package/DateCalendar/DateCalendar.js +6 -4
  16. package/DateCalendar/DateCalendar.types.d.ts +0 -8
  17. package/DigitalClock/DigitalClock.js +3 -2
  18. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  19. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -12
  20. package/TimeClock/TimeClock.js +3 -2
  21. package/hooks/useClearableField.d.ts +1 -1
  22. package/hooks/useClearableField.js +3 -3
  23. package/index.js +1 -1
  24. package/internals/hooks/useViews.d.ts +4 -4
  25. package/internals/hooks/useViews.js +13 -13
  26. package/internals/models/helpers.d.ts +1 -0
  27. package/internals/models/props/clock.d.ts +0 -9
  28. package/legacy/AdapterDateFns/AdapterDateFns.js +278 -528
  29. package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +308 -0
  30. package/legacy/AdapterDateFnsBase/index.js +1 -0
  31. package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +376 -0
  32. package/legacy/AdapterDateFnsV3/index.js +1 -0
  33. package/legacy/DateCalendar/DateCalendar.js +6 -4
  34. package/legacy/DigitalClock/DigitalClock.js +3 -2
  35. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  36. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -12
  37. package/legacy/TimeClock/TimeClock.js +3 -2
  38. package/legacy/hooks/useClearableField.js +3 -3
  39. package/legacy/index.js +1 -1
  40. package/legacy/internals/hooks/useViews.js +13 -13
  41. package/legacy/locales/index.js +1 -0
  42. package/locales/index.d.ts +1 -0
  43. package/locales/index.js +1 -0
  44. package/modern/AdapterDateFns/AdapterDateFns.js +11 -271
  45. package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +307 -0
  46. package/modern/AdapterDateFnsBase/index.js +1 -0
  47. package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +357 -0
  48. package/modern/AdapterDateFnsV3/index.js +1 -0
  49. package/modern/DateCalendar/DateCalendar.js +6 -4
  50. package/modern/DigitalClock/DigitalClock.js +3 -2
  51. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  52. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -12
  53. package/modern/TimeClock/TimeClock.js +3 -2
  54. package/modern/hooks/useClearableField.js +3 -3
  55. package/modern/index.js +1 -1
  56. package/modern/internals/hooks/useViews.js +13 -13
  57. package/modern/locales/index.js +1 -0
  58. package/node/AdapterDateFns/AdapterDateFns.js +11 -271
  59. package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +315 -0
  60. package/node/AdapterDateFnsBase/index.js +12 -0
  61. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +366 -0
  62. package/node/AdapterDateFnsV3/index.js +12 -0
  63. package/node/DateCalendar/DateCalendar.js +6 -4
  64. package/node/DigitalClock/DigitalClock.js +3 -2
  65. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  66. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -12
  67. package/node/TimeClock/TimeClock.js +3 -2
  68. package/node/hooks/useClearableField.js +3 -3
  69. package/node/index.js +1 -1
  70. package/node/internals/hooks/useViews.js +13 -13
  71. package/node/locales/index.js +11 -0
  72. package/package.json +2 -2
@@ -0,0 +1,357 @@
1
+ /* eslint-disable class-methods-use-this */
2
+ // TODO remove when date-fns-v3 is the default
3
+ // @ts-nocheck
4
+ import { addDays } from 'date-fns/addDays';
5
+ import { addSeconds } from 'date-fns/addSeconds';
6
+ import { addMinutes } from 'date-fns/addMinutes';
7
+ import { addHours } from 'date-fns/addHours';
8
+ import { addWeeks } from 'date-fns/addWeeks';
9
+ import { addMonths } from 'date-fns/addMonths';
10
+ import { addYears } from 'date-fns/addYears';
11
+ import { differenceInYears } from 'date-fns/differenceInYears';
12
+ import { differenceInQuarters } from 'date-fns/differenceInQuarters';
13
+ import { differenceInMonths } from 'date-fns/differenceInMonths';
14
+ import { differenceInWeeks } from 'date-fns/differenceInWeeks';
15
+ import { differenceInDays } from 'date-fns/differenceInDays';
16
+ import { differenceInHours } from 'date-fns/differenceInHours';
17
+ import { differenceInMinutes } from 'date-fns/differenceInMinutes';
18
+ import { differenceInSeconds } from 'date-fns/differenceInSeconds';
19
+ import { differenceInMilliseconds } from 'date-fns/differenceInMilliseconds';
20
+ import { eachDayOfInterval } from 'date-fns/eachDayOfInterval';
21
+ import { endOfDay } from 'date-fns/endOfDay';
22
+ import { endOfWeek } from 'date-fns/endOfWeek';
23
+ import { endOfYear } from 'date-fns/endOfYear';
24
+ // @ts-ignore TODO remove when date-fns-v3 is the default
25
+ import { format as dateFnsFormat, longFormatters } from 'date-fns/format';
26
+ import { getDate } from 'date-fns/getDate';
27
+ import { getDaysInMonth } from 'date-fns/getDaysInMonth';
28
+ import { getHours } from 'date-fns/getHours';
29
+ import { getMinutes } from 'date-fns/getMinutes';
30
+ import { getMonth } from 'date-fns/getMonth';
31
+ import { getSeconds } from 'date-fns/getSeconds';
32
+ import { getMilliseconds } from 'date-fns/getMilliseconds';
33
+ import { getWeek } from 'date-fns/getWeek';
34
+ import { getYear } from 'date-fns/getYear';
35
+ import { isAfter } from 'date-fns/isAfter';
36
+ import { isBefore } from 'date-fns/isBefore';
37
+ import { isEqual } from 'date-fns/isEqual';
38
+ import { isSameDay } from 'date-fns/isSameDay';
39
+ import { isSameYear } from 'date-fns/isSameYear';
40
+ import { isSameMonth } from 'date-fns/isSameMonth';
41
+ import { isSameHour } from 'date-fns/isSameHour';
42
+ import { isValid } from 'date-fns/isValid';
43
+ import { parse as dateFnsParse } from 'date-fns/parse';
44
+ import { setDate } from 'date-fns/setDate';
45
+ import { setHours } from 'date-fns/setHours';
46
+ import { setMinutes } from 'date-fns/setMinutes';
47
+ import { setMonth } from 'date-fns/setMonth';
48
+ import { setSeconds } from 'date-fns/setSeconds';
49
+ import { setMilliseconds } from 'date-fns/setMilliseconds';
50
+ import { setYear } from 'date-fns/setYear';
51
+ import { startOfDay } from 'date-fns/startOfDay';
52
+ import { startOfMonth } from 'date-fns/startOfMonth';
53
+ import { endOfMonth } from 'date-fns/endOfMonth';
54
+ import { startOfWeek } from 'date-fns/startOfWeek';
55
+ import { startOfYear } from 'date-fns/startOfYear';
56
+ import { formatISO } from 'date-fns/formatISO';
57
+ import { parseISO } from 'date-fns/parseISO';
58
+ import { isWithinInterval } from 'date-fns/isWithinInterval';
59
+ import { enUS } from 'date-fns/locale/en-US';
60
+ // date-fns v2 does not export types
61
+ // @ts-ignore TODO remove when date-fns-v3 is the default
62
+ import { AdapterDateFnsBase } from '../AdapterDateFnsBase';
63
+
64
+ /**
65
+ * Based on `@date-io/date-fns`
66
+ *
67
+ * MIT License
68
+ *
69
+ * Copyright (c) 2017 Dmitriy Kovalenko
70
+ *
71
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
72
+ * of this software and associated documentation files (the "Software"), to deal
73
+ * in the Software without restriction, including without limitation the rights
74
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
75
+ * copies of the Software, and to permit persons to whom the Software is
76
+ * furnished to do so, subject to the following conditions:
77
+ *
78
+ * The above copyright notice and this permission notice shall be included in all
79
+ * copies or substantial portions of the Software.
80
+ *
81
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
82
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
83
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
85
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
86
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
87
+ * SOFTWARE.
88
+ */
89
+ export class AdapterDateFns extends AdapterDateFnsBase {
90
+ constructor({
91
+ locale,
92
+ formats
93
+ } = {}) {
94
+ if (typeof addDays !== 'function') {
95
+ throw new Error([`MUI: The \`date-fns\` package v2.x is not compatible with this adapter.`, 'Please, install v3.x of the package or use the `AdapterDateFns` instead.'].join('\n'));
96
+ }
97
+ if (!longFormatters) {
98
+ throw new Error('MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.');
99
+ }
100
+ super({
101
+ locale: locale != null ? locale : enUS,
102
+ formats,
103
+ longFormatters
104
+ });
105
+ this.parseISO = isoString => {
106
+ return parseISO(isoString);
107
+ };
108
+ this.toISO = value => {
109
+ return formatISO(value, {
110
+ format: 'extended'
111
+ });
112
+ };
113
+ this.parse = (value, format) => {
114
+ if (value === '') {
115
+ return null;
116
+ }
117
+ return dateFnsParse(value, format, new Date(), {
118
+ locale: this.locale
119
+ });
120
+ };
121
+ this.isValid = value => {
122
+ return isValid(this.date(value));
123
+ };
124
+ this.format = (value, formatKey) => {
125
+ return this.formatByString(value, this.formats[formatKey]);
126
+ };
127
+ this.formatByString = (value, formatString) => {
128
+ return dateFnsFormat(value, formatString, {
129
+ locale: this.locale
130
+ });
131
+ };
132
+ this.getDiff = (value, comparing, unit) => {
133
+ switch (unit) {
134
+ case 'years':
135
+ return differenceInYears(value, this.date(comparing));
136
+ case 'quarters':
137
+ return differenceInQuarters(value, this.date(comparing));
138
+ case 'months':
139
+ return differenceInMonths(value, this.date(comparing));
140
+ case 'weeks':
141
+ return differenceInWeeks(value, this.date(comparing));
142
+ case 'days':
143
+ return differenceInDays(value, this.date(comparing));
144
+ case 'hours':
145
+ return differenceInHours(value, this.date(comparing));
146
+ case 'minutes':
147
+ return differenceInMinutes(value, this.date(comparing));
148
+ case 'seconds':
149
+ return differenceInSeconds(value, this.date(comparing));
150
+ default:
151
+ {
152
+ return differenceInMilliseconds(value, this.date(comparing));
153
+ }
154
+ }
155
+ };
156
+ this.isEqual = (value, comparing) => {
157
+ if (value === null && comparing === null) {
158
+ return true;
159
+ }
160
+ return isEqual(value, comparing);
161
+ };
162
+ this.isSameYear = (value, comparing) => {
163
+ return isSameYear(value, comparing);
164
+ };
165
+ this.isSameMonth = (value, comparing) => {
166
+ return isSameMonth(value, comparing);
167
+ };
168
+ this.isSameDay = (value, comparing) => {
169
+ return isSameDay(value, comparing);
170
+ };
171
+ this.isSameHour = (value, comparing) => {
172
+ return isSameHour(value, comparing);
173
+ };
174
+ this.isAfter = (value, comparing) => {
175
+ return isAfter(value, comparing);
176
+ };
177
+ this.isAfterYear = (value, comparing) => {
178
+ return isAfter(value, endOfYear(comparing));
179
+ };
180
+ this.isAfterDay = (value, comparing) => {
181
+ return isAfter(value, endOfDay(comparing));
182
+ };
183
+ this.isBefore = (value, comparing) => {
184
+ return isBefore(value, comparing);
185
+ };
186
+ this.isBeforeYear = (value, comparing) => {
187
+ return isBefore(value, this.startOfYear(comparing));
188
+ };
189
+ this.isBeforeDay = (value, comparing) => {
190
+ return isBefore(value, this.startOfDay(comparing));
191
+ };
192
+ this.isWithinRange = (value, [start, end]) => {
193
+ return isWithinInterval(value, {
194
+ start,
195
+ end
196
+ });
197
+ };
198
+ this.startOfYear = value => {
199
+ return startOfYear(value);
200
+ };
201
+ this.startOfMonth = value => {
202
+ return startOfMonth(value);
203
+ };
204
+ this.startOfWeek = value => {
205
+ return startOfWeek(value, {
206
+ locale: this.locale
207
+ });
208
+ };
209
+ this.startOfDay = value => {
210
+ return startOfDay(value);
211
+ };
212
+ this.endOfYear = value => {
213
+ return endOfYear(value);
214
+ };
215
+ this.endOfMonth = value => {
216
+ return endOfMonth(value);
217
+ };
218
+ this.endOfWeek = value => {
219
+ return endOfWeek(value, {
220
+ locale: this.locale
221
+ });
222
+ };
223
+ this.endOfDay = value => {
224
+ return endOfDay(value);
225
+ };
226
+ this.addYears = (value, amount) => {
227
+ return addYears(value, amount);
228
+ };
229
+ this.addMonths = (value, amount) => {
230
+ return addMonths(value, amount);
231
+ };
232
+ this.addWeeks = (value, amount) => {
233
+ return addWeeks(value, amount);
234
+ };
235
+ this.addDays = (value, amount) => {
236
+ return addDays(value, amount);
237
+ };
238
+ this.addHours = (value, amount) => {
239
+ return addHours(value, amount);
240
+ };
241
+ this.addMinutes = (value, amount) => {
242
+ return addMinutes(value, amount);
243
+ };
244
+ this.addSeconds = (value, amount) => {
245
+ return addSeconds(value, amount);
246
+ };
247
+ this.getYear = value => {
248
+ return getYear(value);
249
+ };
250
+ this.getMonth = value => {
251
+ return getMonth(value);
252
+ };
253
+ this.getDate = value => {
254
+ return getDate(value);
255
+ };
256
+ this.getHours = value => {
257
+ return getHours(value);
258
+ };
259
+ this.getMinutes = value => {
260
+ return getMinutes(value);
261
+ };
262
+ this.getSeconds = value => {
263
+ return getSeconds(value);
264
+ };
265
+ this.getMilliseconds = value => {
266
+ return getMilliseconds(value);
267
+ };
268
+ this.setYear = (value, year) => {
269
+ return setYear(value, year);
270
+ };
271
+ this.setMonth = (value, month) => {
272
+ return setMonth(value, month);
273
+ };
274
+ this.setDate = (value, date) => {
275
+ return setDate(value, date);
276
+ };
277
+ this.setHours = (value, hours) => {
278
+ return setHours(value, hours);
279
+ };
280
+ this.setMinutes = (value, minutes) => {
281
+ return setMinutes(value, minutes);
282
+ };
283
+ this.setSeconds = (value, seconds) => {
284
+ return setSeconds(value, seconds);
285
+ };
286
+ this.setMilliseconds = (value, milliseconds) => {
287
+ return setMilliseconds(value, milliseconds);
288
+ };
289
+ this.getDaysInMonth = value => {
290
+ return getDaysInMonth(value);
291
+ };
292
+ this.getNextMonth = value => {
293
+ return addMonths(value, 1);
294
+ };
295
+ this.getPreviousMonth = value => {
296
+ return addMonths(value, -1);
297
+ };
298
+ this.getMonthArray = value => {
299
+ const firstMonth = startOfYear(value);
300
+ const monthArray = [firstMonth];
301
+ while (monthArray.length < 12) {
302
+ const prevMonth = monthArray[monthArray.length - 1];
303
+ monthArray.push(this.getNextMonth(prevMonth));
304
+ }
305
+ return monthArray;
306
+ };
307
+ this.mergeDateAndTime = (dateParam, timeParam) => {
308
+ return this.setSeconds(this.setMinutes(this.setHours(dateParam, this.getHours(timeParam)), this.getMinutes(timeParam)), this.getSeconds(timeParam));
309
+ };
310
+ this.getWeekdays = () => {
311
+ const now = new Date();
312
+ return eachDayOfInterval({
313
+ start: startOfWeek(now, {
314
+ locale: this.locale
315
+ }),
316
+ end: endOfWeek(now, {
317
+ locale: this.locale
318
+ })
319
+ }).map(day => this.formatByString(day, 'EEEEEE'));
320
+ };
321
+ this.getWeekArray = value => {
322
+ const start = startOfWeek(startOfMonth(value), {
323
+ locale: this.locale
324
+ });
325
+ const end = endOfWeek(endOfMonth(value), {
326
+ locale: this.locale
327
+ });
328
+ let count = 0;
329
+ let current = start;
330
+ const nestedWeeks = [];
331
+ while (isBefore(current, end)) {
332
+ const weekNumber = Math.floor(count / 7);
333
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
334
+ nestedWeeks[weekNumber].push(current);
335
+ current = addDays(current, 1);
336
+ count += 1;
337
+ }
338
+ return nestedWeeks;
339
+ };
340
+ this.getWeekNumber = value => {
341
+ return getWeek(value, {
342
+ locale: this.locale
343
+ });
344
+ };
345
+ this.getYearRange = (start, end) => {
346
+ const startDate = startOfYear(start);
347
+ const endDate = endOfYear(end);
348
+ const years = [];
349
+ let current = startDate;
350
+ while (isBefore(current, endDate)) {
351
+ years.push(current);
352
+ current = addYears(current, 1);
353
+ }
354
+ return years;
355
+ };
356
+ }
357
+ }
@@ -0,0 +1 @@
1
+ export { AdapterDateFns } from './AdapterDateFnsV3';
@@ -0,0 +1 @@
1
+ export { AdapterDateFns } from './AdapterDateFnsV3';
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/AdapterDateFnsV3/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -38,14 +38,14 @@ export declare class AdapterLuxon implements MuiPickersAdapter<DateTime, string>
38
38
  formatTokenMap: FieldFormatTokenMap;
39
39
  constructor({ locale, formats }?: AdapterOptions<string, never>);
40
40
  private setLocaleToValue;
41
- date: (value?: any) => DateTime | null;
42
- dateWithTimezone: <T extends string | null | undefined>(value: T, timezone: PickersTimezone) => DateBuilderReturnType<T, DateTime>;
41
+ date: (value?: any) => DateTime<true> | DateTime<false> | null;
42
+ dateWithTimezone: <T extends string | null | undefined>(value: T, timezone: PickersTimezone) => DateBuilderReturnType<T, DateTime<boolean>>;
43
43
  getTimezone: (value: DateTime) => string;
44
44
  setTimezone: (value: DateTime, timezone: PickersTimezone) => DateTime;
45
45
  toJsDate: (value: DateTime) => Date;
46
- parseISO: (isoString: string) => DateTime;
46
+ parseISO: (isoString: string) => DateTime<true> | DateTime<false>;
47
47
  toISO: (value: DateTime) => string;
48
- parse: (value: string, formatString: string) => DateTime | null;
48
+ parse: (value: string, formatString: string) => DateTime<true> | DateTime<false> | null;
49
49
  getCurrentLocaleCode: () => string;
50
50
  is12HourCycleInCurrentLocale: () => boolean;
51
51
  expandFormat: (format: string) => string;
@@ -68,21 +68,21 @@ export declare class AdapterLuxon implements MuiPickersAdapter<DateTime, string>
68
68
  isBeforeYear: (value: DateTime, comparing: DateTime) => boolean;
69
69
  isBeforeDay: (value: DateTime, comparing: DateTime) => boolean;
70
70
  isWithinRange: (value: DateTime, [start, end]: [DateTime, DateTime]) => boolean;
71
- startOfYear: (value: DateTime) => DateTime;
72
- startOfMonth: (value: DateTime) => DateTime;
73
- startOfWeek: (value: DateTime) => DateTime;
74
- startOfDay: (value: DateTime) => DateTime;
75
- endOfYear: (value: DateTime) => DateTime;
76
- endOfMonth: (value: DateTime) => DateTime;
77
- endOfWeek: (value: DateTime) => DateTime;
78
- endOfDay: (value: DateTime) => DateTime;
79
- addYears: (value: DateTime, amount: number) => DateTime;
80
- addMonths: (value: DateTime, amount: number) => DateTime;
81
- addWeeks: (value: DateTime, amount: number) => DateTime;
82
- addDays: (value: DateTime, amount: number) => DateTime;
83
- addHours: (value: DateTime, amount: number) => DateTime;
84
- addMinutes: (value: DateTime, amount: number) => DateTime;
85
- addSeconds: (value: DateTime, amount: number) => DateTime;
71
+ startOfYear: (value: DateTime) => DateTime<boolean>;
72
+ startOfMonth: (value: DateTime) => DateTime<boolean>;
73
+ startOfWeek: (value: DateTime) => DateTime<boolean>;
74
+ startOfDay: (value: DateTime) => DateTime<boolean>;
75
+ endOfYear: (value: DateTime) => DateTime<boolean>;
76
+ endOfMonth: (value: DateTime) => DateTime<boolean>;
77
+ endOfWeek: (value: DateTime) => DateTime<boolean>;
78
+ endOfDay: (value: DateTime) => DateTime<boolean>;
79
+ addYears: (value: DateTime, amount: number) => DateTime<boolean>;
80
+ addMonths: (value: DateTime, amount: number) => DateTime<boolean>;
81
+ addWeeks: (value: DateTime, amount: number) => DateTime<boolean>;
82
+ addDays: (value: DateTime, amount: number) => DateTime<boolean>;
83
+ addHours: (value: DateTime, amount: number) => DateTime<boolean>;
84
+ addMinutes: (value: DateTime, amount: number) => DateTime<boolean>;
85
+ addSeconds: (value: DateTime, amount: number) => DateTime<boolean>;
86
86
  getYear: (value: DateTime) => number;
87
87
  getMonth: (value: DateTime) => number;
88
88
  getDate: (value: DateTime) => number;
@@ -90,21 +90,21 @@ export declare class AdapterLuxon implements MuiPickersAdapter<DateTime, string>
90
90
  getMinutes: (value: DateTime) => number;
91
91
  getSeconds: (value: DateTime) => number;
92
92
  getMilliseconds: (value: DateTime) => number;
93
- setYear: (value: DateTime, year: number) => DateTime;
94
- setMonth: (value: DateTime, month: number) => DateTime;
95
- setDate: (value: DateTime, date: number) => DateTime;
96
- setHours: (value: DateTime, hours: number) => DateTime;
97
- setMinutes: (value: DateTime, minutes: number) => DateTime;
98
- setSeconds: (value: DateTime, seconds: number) => DateTime;
99
- setMilliseconds: (value: DateTime, milliseconds: number) => DateTime;
93
+ setYear: (value: DateTime, year: number) => DateTime<boolean>;
94
+ setMonth: (value: DateTime, month: number) => DateTime<boolean>;
95
+ setDate: (value: DateTime, date: number) => DateTime<boolean>;
96
+ setHours: (value: DateTime, hours: number) => DateTime<boolean>;
97
+ setMinutes: (value: DateTime, minutes: number) => DateTime<boolean>;
98
+ setSeconds: (value: DateTime, seconds: number) => DateTime<boolean>;
99
+ setMilliseconds: (value: DateTime, milliseconds: number) => DateTime<boolean>;
100
100
  getDaysInMonth: (value: DateTime) => import("luxon").PossibleDaysInMonth;
101
- getNextMonth: (value: DateTime) => DateTime;
102
- getPreviousMonth: (value: DateTime) => DateTime;
103
- getMonthArray: (value: DateTime) => DateTime[];
104
- mergeDateAndTime: (dateParam: DateTime, timeParam: DateTime) => DateTime;
101
+ getNextMonth: (value: DateTime) => DateTime<boolean>;
102
+ getPreviousMonth: (value: DateTime) => DateTime<boolean>;
103
+ getMonthArray: (value: DateTime) => DateTime<boolean>[];
104
+ mergeDateAndTime: (dateParam: DateTime, timeParam: DateTime) => DateTime<boolean>;
105
105
  getWeekdays: () => string[];
106
- getWeekArray: (value: DateTime) => DateTime[][];
106
+ getWeekArray: (value: DateTime) => DateTime<boolean>[][];
107
107
  getWeekNumber: (value: DateTime) => number;
108
- getYearRange: (start: DateTime, end: DateTime) => DateTime[];
108
+ getYearRange: (start: DateTime, end: DateTime) => DateTime<boolean>[];
109
109
  getMeridiemText: (ampm: 'am' | 'pm') => string;
110
110
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,90 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.19.0
7
+
8
+ _Jan 11, 2024_
9
+
10
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ⏰ Support date-fns v3 (#11659) @LukasTy
13
+ Pickers support both v2 and v3 of date-fns. For v3 use `AdapterDateFnsV3`.
14
+ ```js
15
+ // with date-fns v2.x
16
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
17
+ import de from 'date-fns/locale/de';
18
+ ```
19
+ ```js
20
+ // with date-fns v3.x
21
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
22
+ import { de } from 'date-fns/locale/de';
23
+ ```
24
+
25
+ ### Date Pickers
26
+
27
+ #### `@mui/x-date-pickers@6.19.0`
28
+
29
+ - [pickers] Add date-fns@3.x adapter (#11659) @LukasTy
30
+ - [pickers] Fix clearable behavior blocking focus return to `OpenPickerButton` (#11643) @noraleonte
31
+ - [l10n] Add missing Danish (da-DK) locale export (#11641) @etlos
32
+
33
+ #### `@mui/x-date-pickers-pro@6.19.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
34
+
35
+ Same changes as in `@mui/x-date-pickers@6.19.0`.
36
+
37
+ ### Docs
38
+
39
+ - [docs] Add missing component @oliviertassinari
40
+ - [docs] Fix parsing of `x-date-pickers-pro` demo adapter imports (#11637) @LukasTy
41
+ - [docs] Push up the MUI X brand (#11533) @oliviertassinari
42
+ - [docs] Improve Server-side data grid docs (#11589) @oliviertassinari
43
+ - [docs] Add demo to the charts overview page (#11586) @danilo-leal
44
+ - [docs] Fix 404 links in the docs @oliviertassinari
45
+ - [docs] Improve landing page (#11570) @oliviertassinari
46
+ - [docs] Give a general revision to the docs (#11249) @danilo-leal
47
+
48
+ ## 6.18.7
49
+
50
+ _Jan 5, 2024_
51
+
52
+ We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
53
+
54
+ - 🌍 Improve Czech (cs-CZ) locale on Data Grid (#11429) @wensiet
55
+ - 🐞 Bugfixes
56
+
57
+ ### Data Grid
58
+
59
+ #### `@mui/x-data-grid@6.18.7`
60
+
61
+ - [DataGrid] Don't evaluate `hasEval` when `disableEval` is set (#11553) @reihwald
62
+ - [l10n] Update Czech (cs-CZ) locale (#11498) @fdebef
63
+
64
+ #### `@mui/x-data-grid-pro@6.18.7` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
65
+
66
+ Same changes as in `@mui/x-data-grid@6.18.7`.
67
+
68
+ #### `@mui/x-data-grid-premium@6.18.7` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
69
+
70
+ Same changes as in `@mui/x-data-grid-pro@6.18.7`.
71
+
72
+ ### Date Pickers
73
+
74
+ #### `@mui/x-date-pickers@6.18.7`
75
+
76
+ - [pickers] Fix views management (@LukasTy) (#11572)
77
+
78
+ #### `@mui/x-date-pickers-pro@6.18.7` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
79
+
80
+ Same changes as in `@mui/x-date-pickers@6.18.7`.
81
+
82
+ ### Charts / `@mui/x-charts@6.18.7`
83
+
84
+ - [charts] Fix `null` in line chart using dataset (@alexfauquette) (#11561)
85
+
86
+ ### Docs
87
+
88
+ - [docs] Clarify Pickers usage with Luxon (#11566) @LukasTy
89
+
6
90
  ## 6.18.6
7
91
 
8
92
  _Dec 22, 2023_
@@ -37,7 +121,7 @@ Same changes as in `@mui/x-data-grid-pro@6.18.6`.
37
121
 
38
122
  Same changes as in `@mui/x-date-pickers@6.18.6`.
39
123
 
40
- ### Charts / `@mui/x-charts@6.18.6`
124
+ ### Charts / `@mui/x-charts@6.18.4`
41
125
 
42
126
  - [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
43
127
  - [charts] Make error message more explicit (#11457) @alexfauquette
@@ -258,9 +258,9 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
258
258
  const handleSelectedDayChange = useEventCallback(day => {
259
259
  if (day) {
260
260
  // If there is a date already selected, then we want to keep its time
261
- return handleValueChange(mergeDateAndTime(utils, day, value != null ? value : referenceDate), 'finish');
261
+ return handleValueChange(mergeDateAndTime(utils, day, value != null ? value : referenceDate), 'finish', view);
262
262
  }
263
- return handleValueChange(day, 'finish');
263
+ return handleValueChange(day, 'finish', view);
264
264
  });
265
265
  React.useEffect(() => {
266
266
  if (value != null && utils.isValid(value)) {
@@ -449,9 +449,11 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
449
449
  monthsPerRow: PropTypes.oneOf([3, 4]),
450
450
  /**
451
451
  * Callback fired when the value changes.
452
- * @template TDate
453
- * @param {TDate | null} value The new value.
452
+ * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
453
+ * @template TView The view type. Will be one of date or time views.
454
+ * @param {TValue} value The new value.
454
455
  * @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
456
+ * @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
455
457
  */
456
458
  onChange: PropTypes.func,
457
459
  /**
@@ -6,7 +6,6 @@ import { PickersCalendarHeader, PickersCalendarHeaderProps, PickersCalendarHeade
6
6
  import { DayCalendarSlotsComponent, DayCalendarSlotsComponentsProps, ExportedDayCalendarProps } from './DayCalendar';
7
7
  import { DateCalendarClasses } from './dateCalendarClasses';
8
8
  import { BaseDateValidationProps, YearValidationProps, MonthValidationProps, DayValidationProps } from '../internals/models/validation';
9
- import { PickerSelectionState } from '../internals/hooks/usePicker/usePickerValue.types';
10
9
  import { ExportedUseViewsOptions } from '../internals/hooks/useViews';
11
10
  import { DateView, TimezoneProps } from '../models';
12
11
  import { DefaultizedProps } from '../internals/models/helpers';
@@ -80,13 +79,6 @@ export interface DateCalendarProps<TDate> extends ExportedDateCalendarProps<TDat
80
79
  * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`.
81
80
  */
82
81
  referenceDate?: TDate;
83
- /**
84
- * Callback fired when the value changes.
85
- * @template TDate
86
- * @param {TDate | null} value The new value.
87
- * @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
88
- */
89
- onChange?: (value: TDate | null, selectionState?: PickerSelectionState) => void;
90
82
  className?: string;
91
83
  classes?: Partial<DateCalendarClasses>;
92
84
  /**
@@ -340,8 +340,9 @@ process.env.NODE_ENV !== "production" ? DigitalClock.propTypes = {
340
340
  minutesStep: PropTypes.number,
341
341
  /**
342
342
  * Callback fired when the value changes.
343
- * @template TDate, TView
344
- * @param {TDate | null} value The new value.
343
+ * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
344
+ * @template TView The view type. Will be one of date or time views.
345
+ * @param {TValue} value The new value.
345
346
  * @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
346
347
  * @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
347
348
  */