@mui/x-date-pickers 7.22.3 → 7.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/AdapterMoment/AdapterMoment.js +10 -0
  2. package/CHANGELOG.md +160 -0
  3. package/DateCalendar/DateCalendar.js +1 -0
  4. package/DigitalClock/DigitalClock.js +1 -0
  5. package/MonthCalendar/MonthCalendar.js +2 -1
  6. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  7. package/README.md +3 -3
  8. package/TimeClock/Clock.js +1 -0
  9. package/TimeClock/TimeClock.js +1 -0
  10. package/YearCalendar/YearCalendar.js +2 -1
  11. package/index.js +1 -1
  12. package/internals/hooks/useField/useFieldState.js +1 -0
  13. package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
  14. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  15. package/internals/hooks/usePicker/usePickerValue.js +3 -1
  16. package/internals/hooks/usePicker/usePickerValue.types.d.ts +3 -2
  17. package/internals/hooks/useValueWithTimezone.d.ts +18 -14
  18. package/internals/hooks/useValueWithTimezone.js +13 -1
  19. package/locales/nlNL.js +7 -7
  20. package/modern/AdapterMoment/AdapterMoment.js +10 -0
  21. package/modern/DateCalendar/DateCalendar.js +1 -0
  22. package/modern/DigitalClock/DigitalClock.js +1 -0
  23. package/modern/MonthCalendar/MonthCalendar.js +2 -1
  24. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  25. package/modern/TimeClock/Clock.js +1 -0
  26. package/modern/TimeClock/TimeClock.js +1 -0
  27. package/modern/YearCalendar/YearCalendar.js +2 -1
  28. package/modern/index.js +1 -1
  29. package/modern/internals/hooks/useField/useFieldState.js +1 -0
  30. package/modern/internals/hooks/usePicker/usePickerValue.js +3 -1
  31. package/modern/internals/hooks/useValueWithTimezone.js +13 -1
  32. package/modern/locales/nlNL.js +7 -7
  33. package/node/AdapterMoment/AdapterMoment.js +10 -0
  34. package/node/DateCalendar/DateCalendar.js +1 -0
  35. package/node/DigitalClock/DigitalClock.js +1 -0
  36. package/node/MonthCalendar/MonthCalendar.js +2 -1
  37. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  38. package/node/TimeClock/Clock.js +1 -0
  39. package/node/TimeClock/TimeClock.js +1 -0
  40. package/node/YearCalendar/YearCalendar.js +2 -1
  41. package/node/index.js +1 -1
  42. package/node/internals/hooks/useField/useFieldState.js +1 -0
  43. package/node/internals/hooks/usePicker/usePickerValue.js +3 -1
  44. package/node/internals/hooks/useValueWithTimezone.js +13 -1
  45. package/node/locales/nlNL.js +7 -7
  46. package/package.json +4 -4
@@ -430,12 +430,22 @@ export class AdapterMoment {
430
430
  const end = this.endOfWeek(this.endOfMonth(value));
431
431
  let count = 0;
432
432
  let current = start;
433
+ let currentDayOfYear = current.get('dayOfYear');
433
434
  const nestedWeeks = [];
434
435
  while (current.isBefore(end)) {
435
436
  const weekNumber = Math.floor(count / 7);
436
437
  nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
437
438
  nestedWeeks[weekNumber].push(current);
439
+ const prevDayOfYear = currentDayOfYear;
438
440
  current = this.addDays(current, 1);
441
+ currentDayOfYear = current.get('dayOfYear');
442
+
443
+ // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
444
+ // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
445
+ // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
446
+ if (prevDayOfYear === currentDayOfYear) {
447
+ current = current.add(12, 'h').startOf('day');
448
+ }
439
449
  count += 1;
440
450
  }
441
451
  return nestedWeeks;
package/CHANGELOG.md CHANGED
@@ -3,6 +3,166 @@
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
+ ## 7.23.1
7
+
8
+ _Dec 5, 2024_
9
+
10
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🌍 Improve German locale on the Data Grid component
13
+ - 🐞 Bugfixes
14
+
15
+ Special thanks go out to the community contributors who have helped make this release possible:
16
+ @lhilgert9.
17
+
18
+ Following are all team members who have contributed to this release:
19
+ @arthurbalduini, @cherniavskii, @flaviendelangle, @JCQuintas, @LukasTy and @MBilalShafi.
20
+
21
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@7.23.1`
26
+
27
+ - [DataGrid] Make column autosizing work with flex columns (#15712) @cherniavskii
28
+ - [l10n] Improve German (de-DE) locale (#15641) @lhilgert9
29
+
30
+ #### `@mui/x-data-grid-pro@7.23.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
31
+
32
+ Same changes as in `@mui/x-data-grid@7.23.1`, plus:
33
+
34
+ - [DataGridPro] Cleanup pinned rows on removal (#15702) @cherniavskii
35
+
36
+ #### `@mui/x-data-grid-premium@7.23.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
37
+
38
+ Same changes as in `@mui/x-data-grid-pro@7.23.1`.
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@7.23.1`
43
+
44
+ - [TimePicker] Prevent mouse events after `touchend` event (#15430) @arthurbalduini
45
+
46
+ #### `@mui/x-date-pickers-pro@7.23.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
47
+
48
+ Same changes as in `@mui/x-date-pickers@7.23.1`.
49
+
50
+ ### Charts
51
+
52
+ #### `@mui/x-charts@7.23.1`
53
+
54
+ - [charts] Improve SVG `pattern` and `gradient` support (#15724) @JCQuintas
55
+
56
+ #### `@mui/x-charts-pro@7.23.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
57
+
58
+ Same changes as in `@mui/x-charts@7.23.1`.
59
+
60
+ ### Docs
61
+
62
+ - [docs] Fix Pickers theme augmentation example (#15675) @LukasTy
63
+ - [docs] Remove duplicated warning (#15715) @cherniavskii
64
+ - [test] Force hover in headless Chrome (#15711) @cherniavskii
65
+ - [docs-infra] Bump `@mui/internal-markdown` to support nested demo imports (#15738) @alexfauquette
66
+ - [docs] Improve SEO titles for the Data Grid (#15695) @MBilalShafi
67
+
68
+ ### Core
69
+
70
+ - [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
71
+
72
+ ## 7.23.0
73
+
74
+ _Nov 29, 2024_
75
+
76
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
77
+
78
+ - ✨ Support for a new display mode on the Data Grid with the [List View feature](https://mui.com/x/react-data-grid/list-view/), offering an extremely flexible way to render datasets and enabling developers to adapt how data is displayed across different screen sizes.
79
+
80
+ https://github.com/user-attachments/assets/61286adc-03fc-4323-9739-8ca726fcc16c
81
+
82
+ - ⚛️ React 19 support
83
+ - 📚 Documentation improvements
84
+ - 🌍 Improve Spanish, Portuguese, Chinese locales on the Data Grid component.
85
+ - 🌍 Improve Dutch locale on the Date and Time Picker components.
86
+ - 🐞 Bugfixes
87
+
88
+ Special thanks go out to the community contributors who have helped make this release possible:
89
+ @dloeda, @headironc, @mathzdev, @nphmuller, @lhilgert9, @lauri865.
90
+ Following are all team members who have contributed to this release:
91
+ @oliviertassinari, @arminmeh, @KenanYusuf, @flaviendelangle, @MBilalShafi.
92
+
93
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
94
+
95
+ ### Data Grid
96
+
97
+ #### `@mui/x-data-grid@v7.23.0`
98
+
99
+ - [DataGrid] React 19 support (#15557) @arminmeh
100
+ - [DataGrid] Change test dom check from `/jsdom/` to `/jsdom|HappyDOM/`. (#15642) @jedesroches
101
+ - [DataGrid] Fix last separator not being hidden when grid is scrollable (#15551) @KenanYusuf
102
+ - [DataGrid] Fix order of spread props on toolbar items (#15556) @KenanYusuf
103
+ - [DataGrid] Fix row-spanning in combination with column-pinning (#15460) @lhilgert9
104
+ - [DataGrid] Improve resize performance (#15592) @lauri865
105
+ - [DataGrid] Support column virtualization with dynamic row height (#15567) @cherniavskii
106
+ - [DataGrid] Improve `GridCell` performance (#15621) @lauri865
107
+ - [l10n] Improve Chinese (zh-CN) locale (#15570) @headironc
108
+ - [l10n] Improve Portuguese (pt-PT) locale (#15561) @mathzdev
109
+
110
+ #### `@mui/x-data-grid-pro@v7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
111
+
112
+ Same changes as in `@mui/x-data-grid@v7.23.0`, plus:
113
+
114
+ - [DataGridPro] Fix header filtering with `boolean` column type (#15640) @k-rajat19
115
+ - [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15643) @zinoroman
116
+ - [DataGridPro] Fix selection propagation issue on initialization (#15593) @MBilalShafi
117
+
118
+ #### `@mui/x-data-grid-premium@v7.23.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
119
+
120
+ Same changes as in `@mui/x-data-grid-pro@v7.23.0`.
121
+
122
+ ### Date and Time Pickers
123
+
124
+ #### `@mui/x-date-pickers@v7.23.0`
125
+
126
+ - [pickers] React 19 support (#15557) @arminmeh
127
+ - [pickers] Fix DST issue with `America/Asuncion` timezone and `AdapterMoment` (#15653) @flaviendelangle
128
+ - [pickers] Use `props.referenceDate` timezone when `props.value` and `props.defaultValue` are not defined (#15544) @flaviendelangle
129
+ - [l10n] Improve Dutch (nl-NL) locale (#15564) @nphmuller
130
+
131
+ #### `@mui/x-date-pickers-pro@v7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
132
+
133
+ Same changes as in `@mui/x-date-pickers@v7.23.0`.
134
+
135
+ ### Charts
136
+
137
+ #### `@mui/x-charts@v7.23.0`
138
+
139
+ - [charts] React 19 support (#15557) @arminmeh
140
+ - [charts] Prevent invalid `releasePointerCapture` (#15609) @alexfauquette
141
+
142
+ #### `@mui/x-charts-pro@v7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
143
+
144
+ Same changes as in `@mui/x-charts@v7.23.0`.
145
+
146
+ ### Tree View
147
+
148
+ #### `@mui/x-tree-view@v7.23.0`
149
+
150
+ - [TreeView] React 19 support (#15557) @arminmeh
151
+
152
+ #### `@mui/x-tree-view-pro@7.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
153
+
154
+ Same changes as in `@mui/x-tree-view@7.23.0`.
155
+
156
+ ### Docs
157
+
158
+ - [docs] Add data caching to lazy loaded detail panel demo (#15555) @cherniavskii
159
+ - [docs] Remove selectors section from list view docs (#15639) @KenanYusuf
160
+ - [docs] Add documentation for the list view feature (#15344) @KenanYusuf
161
+
162
+ ### Core
163
+
164
+ - [core] Update @mui/monorepo (#15574) @oliviertassinari
165
+
6
166
  ## 7.22.3
7
167
 
8
168
  _Nov 21, 2024_
@@ -135,6 +135,7 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
135
135
  timezone: timezoneProp,
136
136
  value: valueProp,
137
137
  defaultValue,
138
+ referenceDate: referenceDateProp,
138
139
  onChange,
139
140
  valueManager: singleItemValueManager
140
141
  });
@@ -149,6 +149,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
149
149
  timezone: timezoneProp,
150
150
  value: valueProp,
151
151
  defaultValue,
152
+ referenceDate: referenceDateProp,
152
153
  onChange,
153
154
  valueManager: singleItemValueManager
154
155
  });
@@ -99,7 +99,8 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
99
99
  timezone: timezoneProp,
100
100
  value: valueProp,
101
101
  defaultValue,
102
- onChange: onChange,
102
+ referenceDate: referenceDateProp,
103
+ onChange,
103
104
  valueManager: singleItemValueManager
104
105
  });
105
106
  const now = useNow(timezone);
@@ -101,6 +101,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
101
101
  timezone: timezoneProp,
102
102
  value: valueProp,
103
103
  defaultValue,
104
+ referenceDate: referenceDateProp,
104
105
  onChange,
105
106
  valueManager: singleItemValueManager
106
107
  });
package/README.md CHANGED
@@ -34,9 +34,9 @@ This component has the following peer dependencies that you will need to install
34
34
 
35
35
  ```json
36
36
  "peerDependencies": {
37
- "@mui/material": "^5.15.14",
38
- "react": "^17.0.0 || ^18.0.0",
39
- "react-dom": "^17.0.0 || ^18.0.0"
37
+ "@mui/material": "^5.15.14 || ^6.0.0",
38
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
39
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
40
40
  },
41
41
  ```
42
42
 
@@ -222,6 +222,7 @@ export function Clock(inProps) {
222
222
  setTime(event, 'finish');
223
223
  isMoving.current = false;
224
224
  }
225
+ event.preventDefault();
225
226
  };
226
227
  const handleMouseMove = event => {
227
228
  // event.buttons & PRIMARY_MOUSE_BUTTON
@@ -107,6 +107,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
107
107
  timezone: timezoneProp,
108
108
  value: valueProp,
109
109
  defaultValue,
110
+ referenceDate: referenceDateProp,
110
111
  onChange,
111
112
  valueManager: singleItemValueManager
112
113
  });
@@ -105,7 +105,8 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
105
105
  timezone: timezoneProp,
106
106
  value: valueProp,
107
107
  defaultValue,
108
- onChange: onChange,
108
+ referenceDate: referenceDateProp,
109
+ onChange,
109
110
  valueManager: singleItemValueManager
110
111
  });
111
112
  const now = useNow(timezone);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.22.3
2
+ * @mui/x-date-pickers v7.23.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -41,6 +41,7 @@ export const useFieldState = params => {
41
41
  timezone: timezoneProp,
42
42
  value: valueProp,
43
43
  defaultValue,
44
+ referenceDate: referenceDateProp,
44
45
  onChange,
45
46
  valueManager
46
47
  });
@@ -8,7 +8,7 @@ import { DateOrTimeViewWithMeridiem } from '../../models';
8
8
  */
9
9
  export interface UsePickerBaseProps<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TDate, TView, any, any>, TAdditionalProps extends {}> extends UsePickerValueBaseProps<TValue, TError>, UsePickerViewsBaseProps<TValue, TDate, TView, TExternalProps, TAdditionalProps>, UsePickerLayoutProps {
10
10
  }
11
- export interface UsePickerProps<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TDate, TView, any, any>, TAdditionalProps extends {}> extends UsePickerValueProps<TValue, TError>, UsePickerViewsProps<TValue, TDate, TView, TExternalProps, TAdditionalProps>, UsePickerLayoutProps {
11
+ export interface UsePickerProps<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TDate, TView, any, any>, TAdditionalProps extends {}> extends UsePickerValueProps<TValue, TDate, TError>, UsePickerViewsProps<TValue, TDate, TView, TExternalProps, TAdditionalProps>, UsePickerLayoutProps {
12
12
  }
13
13
  export interface UsePickerParams<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TSection extends FieldSection, TExternalProps extends UsePickerProps<TValue, TDate, TView, any, any, any>, TAdditionalProps extends {}> extends Pick<UsePickerValueParams<TValue, TDate, TExternalProps>, 'valueManager' | 'valueType' | 'wrapperVariant' | 'validator'>, Pick<UsePickerViewParams<TValue, TDate, TView, TSection, TExternalProps, TAdditionalProps>, 'additionalViewProps' | 'autoFocusView' | 'rendererInterceptor' | 'fieldRef'> {
14
14
  props: TExternalProps;
@@ -3,4 +3,4 @@ import { UsePickerValueProps, UsePickerValueParams, UsePickerValueResponse } fro
3
3
  /**
4
4
  * Manage the value lifecycle of all the pickers.
5
5
  */
6
- export declare const usePickerValue: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TExternalProps extends UsePickerValueProps<TValue, any>>({ props, valueManager, valueType, wrapperVariant, validator, }: UsePickerValueParams<TValue, TDate, TExternalProps>) => UsePickerValueResponse<TValue, TSection, InferError<TExternalProps>>;
6
+ export declare const usePickerValue: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TExternalProps extends UsePickerValueProps<TValue, TDate, any>>({ props, valueManager, valueType, wrapperVariant, validator, }: UsePickerValueParams<TValue, TDate, TExternalProps>) => UsePickerValueResponse<TValue, TSection, InferError<TExternalProps>>;
@@ -121,7 +121,8 @@ export const usePickerValue = ({
121
121
  value: inValueWithoutRenderTimezone,
122
122
  defaultValue: inDefaultValue,
123
123
  closeOnSelect = wrapperVariant === 'desktop',
124
- timezone: timezoneProp
124
+ timezone: timezoneProp,
125
+ referenceDate
125
126
  } = props;
126
127
  const {
127
128
  current: defaultValue
@@ -160,6 +161,7 @@ export const usePickerValue = ({
160
161
  timezone: timezoneProp,
161
162
  value: inValueWithoutRenderTimezone,
162
163
  defaultValue,
164
+ referenceDate,
163
165
  onChange,
164
166
  valueManager
165
167
  });
@@ -226,9 +226,10 @@ export interface UsePickerValueNonStaticProps {
226
226
  /**
227
227
  * Props used to handle the value of the pickers.
228
228
  */
229
- export interface UsePickerValueProps<TValue, TError> extends UsePickerValueBaseProps<TValue, TError>, UsePickerValueNonStaticProps, TimezoneProps {
229
+ export interface UsePickerValueProps<TValue, TDate extends PickerValidDate, TError> extends UsePickerValueBaseProps<TValue, TError>, UsePickerValueNonStaticProps, TimezoneProps {
230
+ referenceDate?: TDate;
230
231
  }
231
- export interface UsePickerValueParams<TValue, TDate extends PickerValidDate, TExternalProps extends UsePickerValueProps<TValue, any>> {
232
+ export interface UsePickerValueParams<TValue, TDate extends PickerValidDate, TExternalProps extends UsePickerValueProps<TValue, TDate, any>> {
232
233
  props: TExternalProps;
233
234
  valueManager: PickerValueManager<TValue, TDate, InferError<TExternalProps>>;
234
235
  valueType: FieldValueType;
@@ -5,13 +5,7 @@ import { PickersTimezone, PickerValidDate } from '../../models';
5
5
  * - The value returned by `onChange` always have the timezone of `props.value` or `props.defaultValue` if defined
6
6
  * - The value rendered is always the one from `props.timezone` if defined
7
7
  */
8
- export declare const useValueWithTimezone: <TDate extends PickerValidDate, TValue, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, onChange, valueManager, }: {
9
- timezone: PickersTimezone | undefined;
10
- value: TValue | undefined;
11
- defaultValue: TValue | undefined;
12
- onChange: TChange | undefined;
13
- valueManager: PickerValueManager<TValue, TDate, any>;
14
- }) => {
8
+ export declare const useValueWithTimezone: <TValue, TDate extends PickerValidDate, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange, valueManager, }: UseValueWithTimezoneParameters<TValue, TDate, TChange>) => {
15
9
  value: TValue;
16
10
  handleValueChange: TChange;
17
11
  timezone: string;
@@ -19,15 +13,25 @@ export declare const useValueWithTimezone: <TDate extends PickerValidDate, TValu
19
13
  /**
20
14
  * Wrapper around `useControlled` and `useValueWithTimezone`
21
15
  */
22
- export declare const useControlledValueWithTimezone: <TDate extends PickerValidDate, TValue, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, onChange: onChangeProp, valueManager, }: {
23
- name: string;
16
+ export declare const useControlledValueWithTimezone: <TValue, TDate extends PickerValidDate, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange: onChangeProp, valueManager, }: UseControlledValueWithTimezoneParameters<TValue, TDate, TChange>) => {
17
+ value: TValue;
18
+ handleValueChange: TChange;
19
+ timezone: string;
20
+ };
21
+ interface UseValueWithTimezoneParameters<TValue, TDate extends PickerValidDate, TChange extends (...params: any[]) => void> {
24
22
  timezone: PickersTimezone | undefined;
25
23
  value: TValue | undefined;
26
24
  defaultValue: TValue | undefined;
25
+ /**
26
+ * The reference date as passed to `props.referenceDate`.
27
+ * It does not need to have its default value.
28
+ * This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
29
+ */
30
+ referenceDate: TDate | undefined;
27
31
  onChange: TChange | undefined;
28
32
  valueManager: PickerValueManager<TValue, TDate, any>;
29
- }) => {
30
- value: TValue;
31
- handleValueChange: TChange;
32
- timezone: string;
33
- };
33
+ }
34
+ interface UseControlledValueWithTimezoneParameters<TValue, TDate extends PickerValidDate, TChange extends (...params: any[]) => void> extends UseValueWithTimezoneParameters<TValue, TDate, TChange> {
35
+ name: string;
36
+ }
37
+ export {};
@@ -11,6 +11,7 @@ export const useValueWithTimezone = ({
11
11
  timezone: timezoneProp,
12
12
  value: valueProp,
13
13
  defaultValue,
14
+ referenceDate,
14
15
  onChange,
15
16
  valueManager
16
17
  }) => {
@@ -24,7 +25,16 @@ export const useValueWithTimezone = ({
24
25
  }
25
26
  return valueManager.setTimezone(utils, inputTimezone, newValue);
26
27
  });
27
- const timezoneToRender = timezoneProp ?? inputTimezone ?? 'default';
28
+ let timezoneToRender;
29
+ if (timezoneProp) {
30
+ timezoneToRender = timezoneProp;
31
+ } else if (inputTimezone) {
32
+ timezoneToRender = inputTimezone;
33
+ } else if (referenceDate) {
34
+ timezoneToRender = utils.getTimezone(referenceDate);
35
+ } else {
36
+ timezoneToRender = 'default';
37
+ }
28
38
  const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [valueManager, utils, timezoneToRender, inputValue]);
29
39
  const handleValueChange = useEventCallback((newValue, ...otherParams) => {
30
40
  const newValueWithInputTimezone = setInputTimezone(newValue);
@@ -45,6 +55,7 @@ export const useControlledValueWithTimezone = ({
45
55
  timezone: timezoneProp,
46
56
  value: valueProp,
47
57
  defaultValue,
58
+ referenceDate,
48
59
  onChange: onChangeProp,
49
60
  valueManager
50
61
  }) => {
@@ -62,6 +73,7 @@ export const useControlledValueWithTimezone = ({
62
73
  timezone: timezoneProp,
63
74
  value: valueWithInputTimezone,
64
75
  defaultValue: undefined,
76
+ referenceDate,
65
77
  onChange,
66
78
  valueManager
67
79
  });
package/locales/nlNL.js CHANGED
@@ -16,10 +16,10 @@ const nlNLPickers = {
16
16
  // DateRange labels
17
17
  start: 'Start',
18
18
  end: 'Einde',
19
- startDate: 'Start datum',
20
- startTime: 'Start tijd',
21
- endDate: 'Eind datum',
22
- endTime: 'Eind tijd',
19
+ startDate: 'Startdatum',
20
+ startTime: 'Starttijd',
21
+ endDate: 'Einddatum',
22
+ endTime: 'Eindtijd',
23
23
  // Action bar
24
24
  cancelButtonLabel: 'Annuleren',
25
25
  clearButtonLabel: 'Resetten',
@@ -50,11 +50,11 @@ const nlNLPickers = {
50
50
  timeTableLabel: 'kies tijd',
51
51
  dateTableLabel: 'kies datum',
52
52
  // Field section placeholders
53
- fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
53
+ fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
54
54
  fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
55
55
  fieldDayPlaceholder: () => 'DD',
56
56
  fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
57
- fieldHoursPlaceholder: () => 'hh',
57
+ fieldHoursPlaceholder: () => 'uu',
58
58
  fieldMinutesPlaceholder: () => 'mm',
59
59
  fieldSecondsPlaceholder: () => 'ss',
60
60
  fieldMeridiemPlaceholder: () => 'aa',
@@ -68,6 +68,6 @@ const nlNLPickers = {
68
68
  seconds: 'Seconden',
69
69
  meridiem: 'Middag',
70
70
  // Common
71
- empty: 'Legen'
71
+ empty: 'Leeg'
72
72
  };
73
73
  export const nlNL = getPickersLocalization(nlNLPickers);
@@ -430,12 +430,22 @@ export class AdapterMoment {
430
430
  const end = this.endOfWeek(this.endOfMonth(value));
431
431
  let count = 0;
432
432
  let current = start;
433
+ let currentDayOfYear = current.get('dayOfYear');
433
434
  const nestedWeeks = [];
434
435
  while (current.isBefore(end)) {
435
436
  const weekNumber = Math.floor(count / 7);
436
437
  nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
437
438
  nestedWeeks[weekNumber].push(current);
439
+ const prevDayOfYear = currentDayOfYear;
438
440
  current = this.addDays(current, 1);
441
+ currentDayOfYear = current.get('dayOfYear');
442
+
443
+ // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
444
+ // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
445
+ // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
446
+ if (prevDayOfYear === currentDayOfYear) {
447
+ current = current.add(12, 'h').startOf('day');
448
+ }
439
449
  count += 1;
440
450
  }
441
451
  return nestedWeeks;
@@ -135,6 +135,7 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
135
135
  timezone: timezoneProp,
136
136
  value: valueProp,
137
137
  defaultValue,
138
+ referenceDate: referenceDateProp,
138
139
  onChange,
139
140
  valueManager: singleItemValueManager
140
141
  });
@@ -149,6 +149,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
149
149
  timezone: timezoneProp,
150
150
  value: valueProp,
151
151
  defaultValue,
152
+ referenceDate: referenceDateProp,
152
153
  onChange,
153
154
  valueManager: singleItemValueManager
154
155
  });
@@ -99,7 +99,8 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
99
99
  timezone: timezoneProp,
100
100
  value: valueProp,
101
101
  defaultValue,
102
- onChange: onChange,
102
+ referenceDate: referenceDateProp,
103
+ onChange,
103
104
  valueManager: singleItemValueManager
104
105
  });
105
106
  const now = useNow(timezone);
@@ -101,6 +101,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
101
101
  timezone: timezoneProp,
102
102
  value: valueProp,
103
103
  defaultValue,
104
+ referenceDate: referenceDateProp,
104
105
  onChange,
105
106
  valueManager: singleItemValueManager
106
107
  });
@@ -222,6 +222,7 @@ export function Clock(inProps) {
222
222
  setTime(event, 'finish');
223
223
  isMoving.current = false;
224
224
  }
225
+ event.preventDefault();
225
226
  };
226
227
  const handleMouseMove = event => {
227
228
  // event.buttons & PRIMARY_MOUSE_BUTTON
@@ -107,6 +107,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
107
107
  timezone: timezoneProp,
108
108
  value: valueProp,
109
109
  defaultValue,
110
+ referenceDate: referenceDateProp,
110
111
  onChange,
111
112
  valueManager: singleItemValueManager
112
113
  });
@@ -105,7 +105,8 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
105
105
  timezone: timezoneProp,
106
106
  value: valueProp,
107
107
  defaultValue,
108
- onChange: onChange,
108
+ referenceDate: referenceDateProp,
109
+ onChange,
109
110
  valueManager: singleItemValueManager
110
111
  });
111
112
  const now = useNow(timezone);
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.22.3
2
+ * @mui/x-date-pickers v7.23.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -41,6 +41,7 @@ export const useFieldState = params => {
41
41
  timezone: timezoneProp,
42
42
  value: valueProp,
43
43
  defaultValue,
44
+ referenceDate: referenceDateProp,
44
45
  onChange,
45
46
  valueManager
46
47
  });
@@ -121,7 +121,8 @@ export const usePickerValue = ({
121
121
  value: inValueWithoutRenderTimezone,
122
122
  defaultValue: inDefaultValue,
123
123
  closeOnSelect = wrapperVariant === 'desktop',
124
- timezone: timezoneProp
124
+ timezone: timezoneProp,
125
+ referenceDate
125
126
  } = props;
126
127
  const {
127
128
  current: defaultValue
@@ -160,6 +161,7 @@ export const usePickerValue = ({
160
161
  timezone: timezoneProp,
161
162
  value: inValueWithoutRenderTimezone,
162
163
  defaultValue,
164
+ referenceDate,
163
165
  onChange,
164
166
  valueManager
165
167
  });
@@ -11,6 +11,7 @@ export const useValueWithTimezone = ({
11
11
  timezone: timezoneProp,
12
12
  value: valueProp,
13
13
  defaultValue,
14
+ referenceDate,
14
15
  onChange,
15
16
  valueManager
16
17
  }) => {
@@ -24,7 +25,16 @@ export const useValueWithTimezone = ({
24
25
  }
25
26
  return valueManager.setTimezone(utils, inputTimezone, newValue);
26
27
  });
27
- const timezoneToRender = timezoneProp ?? inputTimezone ?? 'default';
28
+ let timezoneToRender;
29
+ if (timezoneProp) {
30
+ timezoneToRender = timezoneProp;
31
+ } else if (inputTimezone) {
32
+ timezoneToRender = inputTimezone;
33
+ } else if (referenceDate) {
34
+ timezoneToRender = utils.getTimezone(referenceDate);
35
+ } else {
36
+ timezoneToRender = 'default';
37
+ }
28
38
  const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [valueManager, utils, timezoneToRender, inputValue]);
29
39
  const handleValueChange = useEventCallback((newValue, ...otherParams) => {
30
40
  const newValueWithInputTimezone = setInputTimezone(newValue);
@@ -45,6 +55,7 @@ export const useControlledValueWithTimezone = ({
45
55
  timezone: timezoneProp,
46
56
  value: valueProp,
47
57
  defaultValue,
58
+ referenceDate,
48
59
  onChange: onChangeProp,
49
60
  valueManager
50
61
  }) => {
@@ -62,6 +73,7 @@ export const useControlledValueWithTimezone = ({
62
73
  timezone: timezoneProp,
63
74
  value: valueWithInputTimezone,
64
75
  defaultValue: undefined,
76
+ referenceDate,
65
77
  onChange,
66
78
  valueManager
67
79
  });
@@ -16,10 +16,10 @@ const nlNLPickers = {
16
16
  // DateRange labels
17
17
  start: 'Start',
18
18
  end: 'Einde',
19
- startDate: 'Start datum',
20
- startTime: 'Start tijd',
21
- endDate: 'Eind datum',
22
- endTime: 'Eind tijd',
19
+ startDate: 'Startdatum',
20
+ startTime: 'Starttijd',
21
+ endDate: 'Einddatum',
22
+ endTime: 'Eindtijd',
23
23
  // Action bar
24
24
  cancelButtonLabel: 'Annuleren',
25
25
  clearButtonLabel: 'Resetten',
@@ -50,11 +50,11 @@ const nlNLPickers = {
50
50
  timeTableLabel: 'kies tijd',
51
51
  dateTableLabel: 'kies datum',
52
52
  // Field section placeholders
53
- fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
53
+ fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
54
54
  fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
55
55
  fieldDayPlaceholder: () => 'DD',
56
56
  fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
57
- fieldHoursPlaceholder: () => 'hh',
57
+ fieldHoursPlaceholder: () => 'uu',
58
58
  fieldMinutesPlaceholder: () => 'mm',
59
59
  fieldSecondsPlaceholder: () => 'ss',
60
60
  fieldMeridiemPlaceholder: () => 'aa',
@@ -68,6 +68,6 @@ const nlNLPickers = {
68
68
  seconds: 'Seconden',
69
69
  meridiem: 'Middag',
70
70
  // Common
71
- empty: 'Legen'
71
+ empty: 'Leeg'
72
72
  };
73
73
  export const nlNL = getPickersLocalization(nlNLPickers);
@@ -438,12 +438,22 @@ class AdapterMoment {
438
438
  const end = this.endOfWeek(this.endOfMonth(value));
439
439
  let count = 0;
440
440
  let current = start;
441
+ let currentDayOfYear = current.get('dayOfYear');
441
442
  const nestedWeeks = [];
442
443
  while (current.isBefore(end)) {
443
444
  const weekNumber = Math.floor(count / 7);
444
445
  nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
445
446
  nestedWeeks[weekNumber].push(current);
447
+ const prevDayOfYear = currentDayOfYear;
446
448
  current = this.addDays(current, 1);
449
+ currentDayOfYear = current.get('dayOfYear');
450
+
451
+ // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
452
+ // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
453
+ // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
454
+ if (prevDayOfYear === currentDayOfYear) {
455
+ current = current.add(12, 'h').startOf('day');
456
+ }
447
457
  count += 1;
448
458
  }
449
459
  return nestedWeeks;
@@ -142,6 +142,7 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
142
142
  timezone: timezoneProp,
143
143
  value: valueProp,
144
144
  defaultValue,
145
+ referenceDate: referenceDateProp,
145
146
  onChange,
146
147
  valueManager: _valueManagers.singleItemValueManager
147
148
  });
@@ -156,6 +156,7 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
156
156
  timezone: timezoneProp,
157
157
  value: valueProp,
158
158
  defaultValue,
159
+ referenceDate: referenceDateProp,
159
160
  onChange,
160
161
  valueManager: _valueManagers.singleItemValueManager
161
162
  });
@@ -107,7 +107,8 @@ const MonthCalendar = exports.MonthCalendar = /*#__PURE__*/React.forwardRef(func
107
107
  timezone: timezoneProp,
108
108
  value: valueProp,
109
109
  defaultValue,
110
- onChange: onChange,
110
+ referenceDate: referenceDateProp,
111
+ onChange,
111
112
  valueManager: _valueManagers.singleItemValueManager
112
113
  });
113
114
  const now = (0, _useUtils.useNow)(timezone);
@@ -108,6 +108,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
108
108
  timezone: timezoneProp,
109
109
  value: valueProp,
110
110
  defaultValue,
111
+ referenceDate: referenceDateProp,
111
112
  onChange,
112
113
  valueManager: _valueManagers.singleItemValueManager
113
114
  });
@@ -230,6 +230,7 @@ function Clock(inProps) {
230
230
  setTime(event, 'finish');
231
231
  isMoving.current = false;
232
232
  }
233
+ event.preventDefault();
233
234
  };
234
235
  const handleMouseMove = event => {
235
236
  // event.buttons & PRIMARY_MOUSE_BUTTON
@@ -114,6 +114,7 @@ const TimeClock = exports.TimeClock = /*#__PURE__*/React.forwardRef(function Tim
114
114
  timezone: timezoneProp,
115
115
  value: valueProp,
116
116
  defaultValue,
117
+ referenceDate: referenceDateProp,
117
118
  onChange,
118
119
  valueManager: _valueManagers.singleItemValueManager
119
120
  });
@@ -112,7 +112,8 @@ const YearCalendar = exports.YearCalendar = /*#__PURE__*/React.forwardRef(functi
112
112
  timezone: timezoneProp,
113
113
  value: valueProp,
114
114
  defaultValue,
115
- onChange: onChange,
115
+ referenceDate: referenceDateProp,
116
+ onChange,
116
117
  valueManager: _valueManagers.singleItemValueManager
117
118
  });
118
119
  const now = (0, _useUtils.useNow)(timezone);
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.22.3
2
+ * @mui/x-date-pickers v7.23.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -49,6 +49,7 @@ const useFieldState = params => {
49
49
  timezone: timezoneProp,
50
50
  value: valueProp,
51
51
  defaultValue,
52
+ referenceDate: referenceDateProp,
52
53
  onChange,
53
54
  valueManager
54
55
  });
@@ -129,7 +129,8 @@ const usePickerValue = ({
129
129
  value: inValueWithoutRenderTimezone,
130
130
  defaultValue: inDefaultValue,
131
131
  closeOnSelect = wrapperVariant === 'desktop',
132
- timezone: timezoneProp
132
+ timezone: timezoneProp,
133
+ referenceDate
133
134
  } = props;
134
135
  const {
135
136
  current: defaultValue
@@ -168,6 +169,7 @@ const usePickerValue = ({
168
169
  timezone: timezoneProp,
169
170
  value: inValueWithoutRenderTimezone,
170
171
  defaultValue,
172
+ referenceDate,
171
173
  onChange,
172
174
  valueManager
173
175
  });
@@ -19,6 +19,7 @@ const useValueWithTimezone = ({
19
19
  timezone: timezoneProp,
20
20
  value: valueProp,
21
21
  defaultValue,
22
+ referenceDate,
22
23
  onChange,
23
24
  valueManager
24
25
  }) => {
@@ -32,7 +33,16 @@ const useValueWithTimezone = ({
32
33
  }
33
34
  return valueManager.setTimezone(utils, inputTimezone, newValue);
34
35
  });
35
- const timezoneToRender = timezoneProp ?? inputTimezone ?? 'default';
36
+ let timezoneToRender;
37
+ if (timezoneProp) {
38
+ timezoneToRender = timezoneProp;
39
+ } else if (inputTimezone) {
40
+ timezoneToRender = inputTimezone;
41
+ } else if (referenceDate) {
42
+ timezoneToRender = utils.getTimezone(referenceDate);
43
+ } else {
44
+ timezoneToRender = 'default';
45
+ }
36
46
  const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [valueManager, utils, timezoneToRender, inputValue]);
37
47
  const handleValueChange = (0, _useEventCallback.default)((newValue, ...otherParams) => {
38
48
  const newValueWithInputTimezone = setInputTimezone(newValue);
@@ -54,6 +64,7 @@ const useControlledValueWithTimezone = ({
54
64
  timezone: timezoneProp,
55
65
  value: valueProp,
56
66
  defaultValue,
67
+ referenceDate,
57
68
  onChange: onChangeProp,
58
69
  valueManager
59
70
  }) => {
@@ -71,6 +82,7 @@ const useControlledValueWithTimezone = ({
71
82
  timezone: timezoneProp,
72
83
  value: valueWithInputTimezone,
73
84
  defaultValue: undefined,
85
+ referenceDate,
74
86
  onChange,
75
87
  valueManager
76
88
  });
@@ -22,10 +22,10 @@ const nlNLPickers = {
22
22
  // DateRange labels
23
23
  start: 'Start',
24
24
  end: 'Einde',
25
- startDate: 'Start datum',
26
- startTime: 'Start tijd',
27
- endDate: 'Eind datum',
28
- endTime: 'Eind tijd',
25
+ startDate: 'Startdatum',
26
+ startTime: 'Starttijd',
27
+ endDate: 'Einddatum',
28
+ endTime: 'Eindtijd',
29
29
  // Action bar
30
30
  cancelButtonLabel: 'Annuleren',
31
31
  clearButtonLabel: 'Resetten',
@@ -56,11 +56,11 @@ const nlNLPickers = {
56
56
  timeTableLabel: 'kies tijd',
57
57
  dateTableLabel: 'kies datum',
58
58
  // Field section placeholders
59
- fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
59
+ fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
60
60
  fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
61
61
  fieldDayPlaceholder: () => 'DD',
62
62
  fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
63
- fieldHoursPlaceholder: () => 'hh',
63
+ fieldHoursPlaceholder: () => 'uu',
64
64
  fieldMinutesPlaceholder: () => 'mm',
65
65
  fieldSecondsPlaceholder: () => 'ss',
66
66
  fieldMeridiemPlaceholder: () => 'aa',
@@ -74,6 +74,6 @@ const nlNLPickers = {
74
74
  seconds: 'Seconden',
75
75
  meridiem: 'Middag',
76
76
  // Common
77
- empty: 'Legen'
77
+ empty: 'Leeg'
78
78
  };
79
79
  const nlNL = exports.nlNL = (0, _getPickersLocalization.getPickersLocalization)(nlNLPickers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers",
3
- "version": "7.22.3",
3
+ "version": "7.23.1",
4
4
  "description": "The community edition of the Date and Time Picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -41,7 +41,7 @@
41
41
  "clsx": "^2.1.1",
42
42
  "prop-types": "^15.8.1",
43
43
  "react-transition-group": "^4.4.5",
44
- "@mui/x-internals": "7.21.0"
44
+ "@mui/x-internals": "7.23.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@emotion/react": "^11.9.0",
@@ -55,8 +55,8 @@
55
55
  "moment": "^2.29.4",
56
56
  "moment-hijri": "^2.1.2 || ^3.0.0",
57
57
  "moment-jalaali": "^0.7.4 || ^0.8.0 || ^0.9.0 || ^0.10.0",
58
- "react": "^17.0.0 || ^18.0.0",
59
- "react-dom": "^17.0.0 || ^18.0.0"
58
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
59
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
60
60
  },
61
61
  "peerDependenciesMeta": {
62
62
  "@emotion/react": {