@mui/x-date-pickers 7.22.3 → 7.23.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.
- package/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +94 -0
- package/DateCalendar/DateCalendar.js +1 -0
- package/DigitalClock/DigitalClock.js +1 -0
- package/MonthCalendar/MonthCalendar.js +2 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/README.md +3 -3
- package/TimeClock/TimeClock.js +1 -0
- package/YearCalendar/YearCalendar.js +2 -1
- package/index.js +1 -1
- package/internals/hooks/useField/useFieldState.js +1 -0
- package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +3 -1
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +3 -2
- package/internals/hooks/useValueWithTimezone.d.ts +18 -14
- package/internals/hooks/useValueWithTimezone.js +13 -1
- package/locales/nlNL.js +7 -7
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/DateCalendar.js +1 -0
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/MonthCalendar/MonthCalendar.js +2 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/YearCalendar/YearCalendar.js +2 -1
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +3 -1
- package/modern/internals/hooks/useValueWithTimezone.js +13 -1
- package/modern/locales/nlNL.js +7 -7
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/DateCalendar.js +1 -0
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/MonthCalendar/MonthCalendar.js +2 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/YearCalendar/YearCalendar.js +2 -1
- package/node/index.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +3 -1
- package/node/internals/hooks/useValueWithTimezone.js +13 -1
- package/node/locales/nlNL.js +7 -7
- 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,100 @@
|
|
|
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.0
|
|
7
|
+
|
|
8
|
+
_Nov 29, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- ✨ 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.
|
|
13
|
+
|
|
14
|
+
https://github.com/user-attachments/assets/61286adc-03fc-4323-9739-8ca726fcc16c
|
|
15
|
+
|
|
16
|
+
- ⚛️ React 19 support
|
|
17
|
+
- 📚 Documentation improvements
|
|
18
|
+
- 🌍 Improve Spanish, Portuguese, Chinese locales on the Data Grid component.
|
|
19
|
+
- 🌍 Improve Dutch locale on the Date and Time Picker components.
|
|
20
|
+
- 🐞 Bugfixes
|
|
21
|
+
|
|
22
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
23
|
+
@dloeda, @headironc, @mathzdev, @nphmuller, @lhilgert9, @lauri865.
|
|
24
|
+
Following are all team members who have contributed to this release:
|
|
25
|
+
@oliviertassinari, @arminmeh, @KenanYusuf, @flaviendelangle, @MBilalShafi.
|
|
26
|
+
|
|
27
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
28
|
+
|
|
29
|
+
### Data Grid
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid@v7.23.0`
|
|
32
|
+
|
|
33
|
+
- [DataGrid] React 19 support (#15557) @arminmeh
|
|
34
|
+
- [DataGrid] Change test dom check from `/jsdom/` to `/jsdom|HappyDOM/`. (#15642) @jedesroches
|
|
35
|
+
- [DataGrid] Fix last separator not being hidden when grid is scrollable (#15551) @KenanYusuf
|
|
36
|
+
- [DataGrid] Fix order of spread props on toolbar items (#15556) @KenanYusuf
|
|
37
|
+
- [DataGrid] Fix row-spanning in combination with column-pinning (#15460) @lhilgert9
|
|
38
|
+
- [DataGrid] Improve resize performance (#15592) @lauri865
|
|
39
|
+
- [DataGrid] Support column virtualization with dynamic row height (#15567) @cherniavskii
|
|
40
|
+
- [DataGrid] Improve `GridCell` performance (#15621) @lauri865
|
|
41
|
+
- [l10n] Improve Chinese (zh-CN) locale (#15570) @headironc
|
|
42
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#15561) @mathzdev
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid-pro@v7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-data-grid@v7.23.0`, plus:
|
|
47
|
+
|
|
48
|
+
- [DataGridPro] Fix header filtering with `boolean` column type (#15640) @k-rajat19
|
|
49
|
+
- [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15643) @zinoroman
|
|
50
|
+
- [DataGridPro] Fix selection propagation issue on initialization (#15593) @MBilalShafi
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-data-grid-premium@v7.23.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
53
|
+
|
|
54
|
+
Same changes as in `@mui/x-data-grid-pro@v7.23.0`.
|
|
55
|
+
|
|
56
|
+
### Date and Time Pickers
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-date-pickers@v7.23.0`
|
|
59
|
+
|
|
60
|
+
- [pickers] React 19 support (#15557) @arminmeh
|
|
61
|
+
- [pickers] Fix DST issue with `America/Asuncion` timezone and `AdapterMoment` (#15653) @flaviendelangle
|
|
62
|
+
- [pickers] Use `props.referenceDate` timezone when `props.value` and `props.defaultValue` are not defined (#15544) @flaviendelangle
|
|
63
|
+
- [l10n] Improve Dutch (nl-NL) locale (#15564) @nphmuller
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-date-pickers-pro@v7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
66
|
+
|
|
67
|
+
Same changes as in `@mui/x-date-pickers@v7.23.0`.
|
|
68
|
+
|
|
69
|
+
### Charts
|
|
70
|
+
|
|
71
|
+
#### `@mui/x-charts@v7.23.0`
|
|
72
|
+
|
|
73
|
+
- [charts] React 19 support (#15557) @arminmeh
|
|
74
|
+
- [charts] Prevent invalid `releasePointerCapture` (#15609) @alexfauquette
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-charts-pro@v7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
77
|
+
|
|
78
|
+
Same changes as in `@mui/x-charts@v7.23.0`.
|
|
79
|
+
|
|
80
|
+
### Tree View
|
|
81
|
+
|
|
82
|
+
#### `@mui/x-tree-view@v7.23.0`
|
|
83
|
+
|
|
84
|
+
- [TreeView] React 19 support (#15557) @arminmeh
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-tree-view-pro@7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
87
|
+
|
|
88
|
+
Same changes as in `@mui/x-tree-view@7.23.0`.
|
|
89
|
+
|
|
90
|
+
### Docs
|
|
91
|
+
|
|
92
|
+
- [docs] Add data caching to lazy loaded detail panel demo (#15555) @cherniavskii
|
|
93
|
+
- [docs] Remove selectors section from list view docs (#15639) @KenanYusuf
|
|
94
|
+
- [docs] Add documentation for the list view feature (#15344) @KenanYusuf
|
|
95
|
+
|
|
96
|
+
### Core
|
|
97
|
+
|
|
98
|
+
- [core] Update @mui/monorepo (#15574) @oliviertassinari
|
|
99
|
+
|
|
6
100
|
## 7.22.3
|
|
7
101
|
|
|
8
102
|
_Nov 21, 2024_
|
|
@@ -99,7 +99,8 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
99
99
|
timezone: timezoneProp,
|
|
100
100
|
value: valueProp,
|
|
101
101
|
defaultValue,
|
|
102
|
-
|
|
102
|
+
referenceDate: referenceDateProp,
|
|
103
|
+
onChange,
|
|
103
104
|
valueManager: singleItemValueManager
|
|
104
105
|
});
|
|
105
106
|
const now = useNow(timezone);
|
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
|
|
package/TimeClock/TimeClock.js
CHANGED
|
@@ -105,7 +105,8 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
105
105
|
timezone: timezoneProp,
|
|
106
106
|
value: valueProp,
|
|
107
107
|
defaultValue,
|
|
108
|
-
|
|
108
|
+
referenceDate: referenceDateProp,
|
|
109
|
+
onChange,
|
|
109
110
|
valueManager: singleItemValueManager
|
|
110
111
|
});
|
|
111
112
|
const now = useNow(timezone);
|
package/index.js
CHANGED
|
@@ -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,
|
|
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,
|
|
23
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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: '
|
|
20
|
-
startTime: '
|
|
21
|
-
endDate: '
|
|
22
|
-
endTime: '
|
|
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 => '
|
|
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: () => '
|
|
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: '
|
|
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;
|
|
@@ -99,7 +99,8 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
99
99
|
timezone: timezoneProp,
|
|
100
100
|
value: valueProp,
|
|
101
101
|
defaultValue,
|
|
102
|
-
|
|
102
|
+
referenceDate: referenceDateProp,
|
|
103
|
+
onChange,
|
|
103
104
|
valueManager: singleItemValueManager
|
|
104
105
|
});
|
|
105
106
|
const now = useNow(timezone);
|
|
@@ -105,7 +105,8 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
105
105
|
timezone: timezoneProp,
|
|
106
106
|
value: valueProp,
|
|
107
107
|
defaultValue,
|
|
108
|
-
|
|
108
|
+
referenceDate: referenceDateProp,
|
|
109
|
+
onChange,
|
|
109
110
|
valueManager: singleItemValueManager
|
|
110
111
|
});
|
|
111
112
|
const now = useNow(timezone);
|
package/modern/index.js
CHANGED
|
@@ -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
|
-
|
|
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/modern/locales/nlNL.js
CHANGED
|
@@ -16,10 +16,10 @@ const nlNLPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: 'Start',
|
|
18
18
|
end: 'Einde',
|
|
19
|
-
startDate: '
|
|
20
|
-
startTime: '
|
|
21
|
-
endDate: '
|
|
22
|
-
endTime: '
|
|
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 => '
|
|
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: () => '
|
|
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: '
|
|
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
|
-
|
|
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
|
});
|
|
@@ -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
|
-
|
|
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
|
@@ -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
|
-
|
|
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
|
});
|
package/node/locales/nlNL.js
CHANGED
|
@@ -22,10 +22,10 @@ const nlNLPickers = {
|
|
|
22
22
|
// DateRange labels
|
|
23
23
|
start: 'Start',
|
|
24
24
|
end: 'Einde',
|
|
25
|
-
startDate: '
|
|
26
|
-
startTime: '
|
|
27
|
-
endDate: '
|
|
28
|
-
endTime: '
|
|
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 => '
|
|
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: () => '
|
|
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: '
|
|
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.
|
|
3
|
+
"version": "7.23.0",
|
|
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.
|
|
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": {
|