@mui/x-date-pickers 7.0.0-alpha.0 → 7.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +6 -17
- package/AdapterDateFns/AdapterDateFns.js +9 -93
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +6 -17
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
- package/AdapterDayjs/AdapterDayjs.d.ts +7 -19
- package/AdapterDayjs/AdapterDayjs.js +13 -67
- package/AdapterLuxon/AdapterLuxon.d.ts +6 -17
- package/AdapterLuxon/AdapterLuxon.js +5 -96
- package/AdapterMoment/AdapterMoment.d.ts +6 -22
- package/AdapterMoment/AdapterMoment.js +11 -75
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -9
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -11
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
- package/CHANGELOG.md +591 -5
- package/DateCalendar/DateCalendar.js +2 -9
- package/DateCalendar/DateCalendar.types.d.ts +0 -4
- package/DateCalendar/DayCalendar.d.ts +1 -2
- package/DateCalendar/DayCalendar.js +9 -16
- package/DateCalendar/dayCalendarClasses.d.ts +1 -1
- package/DateCalendar/dayCalendarClasses.js +1 -1
- package/DateCalendar/index.d.ts +1 -2
- package/DateCalendar/index.js +2 -4
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DateCalendar/useCalendarState.js +1 -9
- package/DateField/DateField.js +1 -1
- package/DatePicker/DatePicker.js +1 -6
- package/DatePicker/shared.d.ts +1 -1
- package/DateTimeField/DateTimeField.js +1 -9
- package/DateTimePicker/DateTimePicker.js +1 -14
- package/DateTimePicker/shared.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/DigitalClock/DigitalClock.js +6 -17
- package/LocalizationProvider/LocalizationProvider.js +0 -6
- package/MobileDatePicker/MobileDatePicker.js +1 -6
- package/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/MobileTimePicker/MobileTimePicker.js +1 -9
- package/MonthCalendar/MonthCalendar.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/PickersDay/PickersDay.js +1 -1
- package/StaticDatePicker/StaticDatePicker.js +1 -6
- package/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/StaticTimePicker/StaticTimePicker.js +1 -9
- package/TimeClock/Clock.js +1 -1
- package/TimeClock/TimeClock.js +3 -15
- package/TimeField/TimeField.js +1 -9
- package/TimePicker/TimePicker.js +1 -9
- package/TimePicker/shared.d.ts +1 -1
- package/YearCalendar/YearCalendar.js +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +2 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.js +0 -2
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -0
- package/internals/hooks/date-helpers-hooks.js +2 -2
- package/internals/hooks/useField/useField.utils.js +8 -9
- package/internals/hooks/useField/useFieldState.js +2 -2
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +1 -1
- package/internals/hooks/useUtils.js +1 -1
- package/internals/hooks/useViews.js +2 -2
- package/internals/models/validation.d.ts +0 -8
- package/internals/utils/date-utils.js +2 -2
- package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
- package/internals/utils/getDefaultReferenceDate.js +0 -4
- package/internals/utils/validation/extractValidationProps.d.ts +1 -1
- package/internals/utils/validation/extractValidationProps.js +1 -1
- package/internals/utils/validation/validateDate.js +1 -1
- package/internals/utils/validation/validateTime.js +1 -8
- package/legacy/AdapterDateFns/AdapterDateFns.js +13 -94
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +13 -94
- package/legacy/AdapterDayjs/AdapterDayjs.js +19 -69
- package/legacy/AdapterLuxon/AdapterLuxon.js +10 -97
- package/legacy/AdapterMoment/AdapterMoment.js +16 -78
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -33
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -43
- package/legacy/DateCalendar/DateCalendar.js +2 -9
- package/legacy/DateCalendar/DayCalendar.js +7 -11
- package/legacy/DateCalendar/PickersSlideTransition.js +8 -9
- package/legacy/DateCalendar/dayCalendarClasses.js +1 -1
- package/legacy/DateCalendar/index.js +2 -4
- package/legacy/DateCalendar/useCalendarState.js +1 -9
- package/legacy/DateField/DateField.js +1 -1
- package/legacy/DatePicker/DatePicker.js +1 -6
- package/legacy/DateTimeField/DateTimeField.js +1 -9
- package/legacy/DateTimePicker/DateTimePicker.js +1 -14
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/legacy/DigitalClock/DigitalClock.js +6 -17
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
- package/legacy/MobileDatePicker/MobileDatePicker.js +1 -6
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/legacy/MobileTimePicker/MobileTimePicker.js +1 -9
- package/legacy/MonthCalendar/MonthCalendar.js +1 -1
- package/legacy/MonthCalendar/PickersMonth.js +4 -5
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +11 -3
- package/legacy/PickersDay/PickersDay.js +6 -7
- package/legacy/PickersLayout/PickersLayout.js +5 -6
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -6
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/legacy/StaticTimePicker/StaticTimePicker.js +1 -9
- package/legacy/TimeClock/Clock.js +1 -1
- package/legacy/TimeClock/ClockNumber.js +4 -5
- package/legacy/TimeClock/TimeClock.js +3 -15
- package/legacy/TimeField/TimeField.js +1 -9
- package/legacy/TimePicker/TimePicker.js +1 -9
- package/legacy/TimePicker/TimePickerToolbar.js +1 -2
- package/legacy/YearCalendar/PickersYear.js +4 -5
- package/legacy/YearCalendar/YearCalendar.js +2 -2
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/legacy/dateViewRenderers/dateViewRenderers.js +0 -2
- package/legacy/index.js +4 -1
- package/legacy/internals/components/PickersModalDialog.js +3 -4
- package/legacy/internals/hooks/date-helpers-hooks.js +2 -2
- package/legacy/internals/hooks/useField/useField.utils.js +8 -9
- package/legacy/internals/hooks/useField/useFieldState.js +2 -2
- package/legacy/internals/hooks/useUtils.js +1 -1
- package/legacy/internals/hooks/useViews.js +2 -2
- package/legacy/internals/utils/date-utils.js +2 -2
- package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
- package/legacy/internals/utils/validation/extractValidationProps.js +1 -1
- package/legacy/internals/utils/validation/validateDate.js +1 -1
- package/legacy/internals/utils/validation/validateTime.js +1 -8
- package/legacy/locales/deDE.js +4 -3
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/mk.js +91 -0
- package/legacy/timeViewRenderers/timeViewRenderers.js +0 -6
- package/locales/deDE.js +2 -3
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/mk.d.ts +53 -0
- package/locales/mk.js +55 -0
- package/models/adapters.d.ts +16 -145
- package/models/fields.d.ts +0 -6
- package/models/timezone.d.ts +1 -1
- package/models/validation.d.ts +1 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +9 -93
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
- package/modern/AdapterDayjs/AdapterDayjs.js +13 -66
- package/modern/AdapterLuxon/AdapterLuxon.js +5 -96
- package/modern/AdapterMoment/AdapterMoment.js +11 -74
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
- package/modern/DateCalendar/DateCalendar.js +2 -9
- package/modern/DateCalendar/DayCalendar.js +9 -15
- package/modern/DateCalendar/dayCalendarClasses.js +1 -1
- package/modern/DateCalendar/index.js +2 -4
- package/modern/DateCalendar/useCalendarState.js +1 -9
- package/modern/DateField/DateField.js +1 -1
- package/modern/DatePicker/DatePicker.js +1 -6
- package/modern/DateTimeField/DateTimeField.js +1 -9
- package/modern/DateTimePicker/DateTimePicker.js +1 -14
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/modern/DigitalClock/DigitalClock.js +6 -17
- package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -6
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/modern/MobileTimePicker/MobileTimePicker.js +1 -9
- package/modern/MonthCalendar/MonthCalendar.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/modern/PickersDay/PickersDay.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -6
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/modern/StaticTimePicker/StaticTimePicker.js +1 -9
- package/modern/TimeClock/Clock.js +1 -1
- package/modern/TimeClock/TimeClock.js +3 -15
- package/modern/TimeField/TimeField.js +1 -9
- package/modern/TimePicker/TimePicker.js +1 -9
- package/modern/YearCalendar/YearCalendar.js +2 -2
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/modern/dateViewRenderers/dateViewRenderers.js +0 -2
- package/modern/index.js +4 -1
- package/modern/internals/hooks/date-helpers-hooks.js +2 -2
- package/modern/internals/hooks/useField/useField.utils.js +8 -9
- package/modern/internals/hooks/useField/useFieldState.js +2 -2
- package/modern/internals/hooks/useUtils.js +1 -1
- package/modern/internals/hooks/useViews.js +2 -2
- package/modern/internals/utils/date-utils.js +2 -2
- package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
- package/modern/internals/utils/validation/extractValidationProps.js +1 -1
- package/modern/internals/utils/validation/validateDate.js +1 -1
- package/modern/internals/utils/validation/validateTime.js +1 -8
- package/modern/locales/deDE.js +2 -3
- package/modern/locales/index.js +1 -0
- package/modern/locales/mk.js +55 -0
- package/modern/timeViewRenderers/timeViewRenderers.js +0 -6
- package/node/AdapterDateFns/AdapterDateFns.js +9 -93
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +9 -93
- package/node/AdapterDayjs/AdapterDayjs.js +13 -66
- package/node/AdapterLuxon/AdapterLuxon.js +5 -96
- package/node/AdapterMoment/AdapterMoment.js +11 -74
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -33
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -43
- package/node/DateCalendar/DateCalendar.js +2 -9
- package/node/DateCalendar/DayCalendar.js +9 -15
- package/node/DateCalendar/dayCalendarClasses.js +2 -2
- package/node/DateCalendar/index.js +3 -23
- package/node/DateCalendar/useCalendarState.js +1 -9
- package/node/DateField/DateField.js +1 -1
- package/node/DatePicker/DatePicker.js +1 -6
- package/node/DateTimeField/DateTimeField.js +1 -9
- package/node/DateTimePicker/DateTimePicker.js +1 -14
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -6
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -14
- package/node/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/node/DigitalClock/DigitalClock.js +6 -17
- package/node/LocalizationProvider/LocalizationProvider.js +0 -6
- package/node/MobileDatePicker/MobileDatePicker.js +1 -6
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -14
- package/node/MobileTimePicker/MobileTimePicker.js +1 -9
- package/node/MonthCalendar/MonthCalendar.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -15
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/node/PickersDay/PickersDay.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +1 -6
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -14
- package/node/StaticTimePicker/StaticTimePicker.js +1 -9
- package/node/TimeClock/Clock.js +1 -1
- package/node/TimeClock/TimeClock.js +3 -15
- package/node/TimeField/TimeField.js +1 -9
- package/node/TimePicker/TimePicker.js +1 -9
- package/node/YearCalendar/YearCalendar.js +2 -2
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/node/dateViewRenderers/dateViewRenderers.js +0 -2
- package/node/index.js +13 -1
- package/node/internals/hooks/date-helpers-hooks.js +2 -2
- package/node/internals/hooks/useField/useField.utils.js +8 -9
- package/node/internals/hooks/useField/useFieldState.js +2 -2
- package/node/internals/hooks/useUtils.js +1 -1
- package/node/internals/hooks/useViews.js +2 -2
- package/node/internals/utils/date-utils.js +2 -2
- package/node/internals/utils/getDefaultReferenceDate.js +1 -3
- package/node/internals/utils/validation/extractValidationProps.js +1 -1
- package/node/internals/utils/validation/validateDate.js +1 -1
- package/node/internals/utils/validation/validateTime.js +1 -8
- package/node/locales/deDE.js +2 -3
- package/node/locales/index.js +11 -0
- package/node/locales/mk.js +60 -0
- package/node/timeViewRenderers/timeViewRenderers.js +0 -6
- package/package.json +7 -6
- package/themeAugmentation/overrides.d.ts +1 -1
- package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
- package/timeViewRenderers/timeViewRenderers.js +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
|
|
3
|
+
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -126,7 +126,8 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
126
126
|
views,
|
|
127
127
|
labelId,
|
|
128
128
|
className,
|
|
129
|
-
timezone
|
|
129
|
+
timezone,
|
|
130
|
+
format = `${utils.formats.month} ${utils.formats.year}`
|
|
130
131
|
} = props,
|
|
131
132
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
132
133
|
const ownerState = props;
|
|
@@ -180,6 +181,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
180
181
|
if (views.length === 1 && views[0] === 'year') {
|
|
181
182
|
return null;
|
|
182
183
|
}
|
|
184
|
+
const label = utils.formatByString(month, format);
|
|
183
185
|
return /*#__PURE__*/_jsxs(PickersCalendarHeaderRoot, _extends({}, other, {
|
|
184
186
|
ownerState: ownerState,
|
|
185
187
|
className: clsx(className, classes.root),
|
|
@@ -194,12 +196,12 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
194
196
|
className: classes.labelContainer,
|
|
195
197
|
children: [/*#__PURE__*/_jsx(PickersFadeTransitionGroup, {
|
|
196
198
|
reduceAnimations: reduceAnimations,
|
|
197
|
-
transKey:
|
|
199
|
+
transKey: label,
|
|
198
200
|
children: /*#__PURE__*/_jsx(PickersCalendarHeaderLabel, {
|
|
199
201
|
id: labelId,
|
|
200
202
|
ownerState: ownerState,
|
|
201
203
|
className: classes.label,
|
|
202
|
-
children:
|
|
204
|
+
children: label
|
|
203
205
|
})
|
|
204
206
|
}), views.length > 1 && !disabled && /*#__PURE__*/_jsx(SwitchViewButton, _extends({}, switchViewButtonProps, {
|
|
205
207
|
children: /*#__PURE__*/_jsx(SwitchViewIcon, _extends({}, switchViewIconProps))
|
|
@@ -236,6 +238,11 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
|
|
|
236
238
|
disabled: PropTypes.bool,
|
|
237
239
|
disableFuture: PropTypes.bool,
|
|
238
240
|
disablePast: PropTypes.bool,
|
|
241
|
+
/**
|
|
242
|
+
* Format used to display the date.
|
|
243
|
+
* @default `${adapter.formats.month} ${adapter.formats.year}`
|
|
244
|
+
*/
|
|
245
|
+
format: PropTypes.string,
|
|
239
246
|
labelId: PropTypes.string,
|
|
240
247
|
maxDate: PropTypes.any.isRequired,
|
|
241
248
|
minDate: PropTypes.any.isRequired,
|
|
@@ -156,7 +156,7 @@ const PickersDayRaw = /*#__PURE__*/React.forwardRef(function PickersDay(inProps,
|
|
|
156
156
|
}
|
|
157
157
|
}, [autoFocus, disabled, isAnimating, outsideCurrentMonth]);
|
|
158
158
|
|
|
159
|
-
// For day outside
|
|
159
|
+
// For a day outside the current month, move the focus from mouseDown to mouseUp
|
|
160
160
|
// Goal: have the onClick ends before sliding to the new month
|
|
161
161
|
const handleMouseDown = event => {
|
|
162
162
|
onMouseDown(event);
|
|
@@ -65,16 +65,11 @@ StaticDatePicker.propTypes = {
|
|
|
65
65
|
className: PropTypes.string,
|
|
66
66
|
/**
|
|
67
67
|
* Formats the day of week displayed in the calendar header.
|
|
68
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
69
68
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
70
69
|
* @returns {string} The name to display.
|
|
71
70
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
72
71
|
*/
|
|
73
72
|
dayOfWeekFormatter: PropTypes.func,
|
|
74
|
-
/**
|
|
75
|
-
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
76
|
-
*/
|
|
77
|
-
defaultCalendarMonth: PropTypes.any,
|
|
78
73
|
/**
|
|
79
74
|
* The default value.
|
|
80
75
|
* Used when the component is not controlled.
|
|
@@ -267,7 +262,7 @@ StaticDatePicker.propTypes = {
|
|
|
267
262
|
* Choose which timezone to use for the value.
|
|
268
263
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
269
264
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
270
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
265
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
271
266
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
272
267
|
*/
|
|
273
268
|
timezone: PropTypes.string,
|
|
@@ -85,16 +85,11 @@ StaticDateTimePicker.propTypes = {
|
|
|
85
85
|
className: PropTypes.string,
|
|
86
86
|
/**
|
|
87
87
|
* Formats the day of week displayed in the calendar header.
|
|
88
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
89
88
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
90
89
|
* @returns {string} The name to display.
|
|
91
90
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
92
91
|
*/
|
|
93
92
|
dayOfWeekFormatter: PropTypes.func,
|
|
94
|
-
/**
|
|
95
|
-
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
96
|
-
*/
|
|
97
|
-
defaultCalendarMonth: PropTypes.any,
|
|
98
93
|
/**
|
|
99
94
|
* The default value.
|
|
100
95
|
* Used when the component is not controlled.
|
|
@@ -262,14 +257,6 @@ StaticDateTimePicker.propTypes = {
|
|
|
262
257
|
* @default () => <span data-mui-test="loading-progress">...</span>
|
|
263
258
|
*/
|
|
264
259
|
renderLoading: PropTypes.func,
|
|
265
|
-
/**
|
|
266
|
-
* Disable specific clock time.
|
|
267
|
-
* @param {number} clockValue The value to check.
|
|
268
|
-
* @param {TimeView} view The clock type of the timeValue.
|
|
269
|
-
* @returns {boolean} If `true` the time will be disabled.
|
|
270
|
-
* @deprecated Consider using `shouldDisableTime`.
|
|
271
|
-
*/
|
|
272
|
-
shouldDisableClock: PropTypes.func,
|
|
273
260
|
/**
|
|
274
261
|
* Disable specific date.
|
|
275
262
|
*
|
|
@@ -331,7 +318,7 @@ StaticDateTimePicker.propTypes = {
|
|
|
331
318
|
* Choose which timezone to use for the value.
|
|
332
319
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
333
320
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
334
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
321
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
335
322
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
336
323
|
*/
|
|
337
324
|
timezone: PropTypes.string,
|
|
@@ -182,14 +182,6 @@ StaticTimePicker.propTypes = {
|
|
|
182
182
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
183
183
|
*/
|
|
184
184
|
referenceDate: PropTypes.any,
|
|
185
|
-
/**
|
|
186
|
-
* Disable specific clock time.
|
|
187
|
-
* @param {number} clockValue The value to check.
|
|
188
|
-
* @param {TimeView} view The clock type of the timeValue.
|
|
189
|
-
* @returns {boolean} If `true` the time will be disabled.
|
|
190
|
-
* @deprecated Consider using `shouldDisableTime`.
|
|
191
|
-
*/
|
|
192
|
-
shouldDisableClock: PropTypes.func,
|
|
193
185
|
/**
|
|
194
186
|
* Disable specific time.
|
|
195
187
|
* @template TDate
|
|
@@ -216,7 +208,7 @@ StaticTimePicker.propTypes = {
|
|
|
216
208
|
* Choose which timezone to use for the value.
|
|
217
209
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
218
210
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
219
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
211
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
220
212
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
221
213
|
*/
|
|
222
214
|
timezone: PropTypes.string,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "
|
|
3
|
+
const _excluded = ["ampm", "ampmInClock", "autoFocus", "slots", "slotProps", "value", "defaultValue", "referenceDate", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableTime", "showViewSwitcher", "onChange", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "timezone"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -81,7 +81,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
81
81
|
disableFuture,
|
|
82
82
|
disablePast,
|
|
83
83
|
minutesStep = 1,
|
|
84
|
-
shouldDisableClock,
|
|
85
84
|
shouldDisableTime,
|
|
86
85
|
showViewSwitcher,
|
|
87
86
|
onChange,
|
|
@@ -162,9 +161,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
162
161
|
if (timeValue % step !== 0) {
|
|
163
162
|
return false;
|
|
164
163
|
}
|
|
165
|
-
if (shouldDisableClock?.(timeValue, viewType)) {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
164
|
if (shouldDisableTime) {
|
|
169
165
|
switch (viewType) {
|
|
170
166
|
case 'hours':
|
|
@@ -214,7 +210,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
|
|
|
214
210
|
default:
|
|
215
211
|
throw new Error('not supported');
|
|
216
212
|
}
|
|
217
|
-
}, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep,
|
|
213
|
+
}, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
|
|
218
214
|
const selectedId = useId();
|
|
219
215
|
const viewProps = React.useMemo(() => {
|
|
220
216
|
switch (view) {
|
|
@@ -422,14 +418,6 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
422
418
|
* @default The closest valid time using the validation props, except callbacks such as `shouldDisableTime`.
|
|
423
419
|
*/
|
|
424
420
|
referenceDate: PropTypes.any,
|
|
425
|
-
/**
|
|
426
|
-
* Disable specific clock time.
|
|
427
|
-
* @param {number} clockValue The value to check.
|
|
428
|
-
* @param {TimeView} view The clock type of the timeValue.
|
|
429
|
-
* @returns {boolean} If `true` the time will be disabled.
|
|
430
|
-
* @deprecated Consider using `shouldDisableTime`.
|
|
431
|
-
*/
|
|
432
|
-
shouldDisableClock: PropTypes.func,
|
|
433
421
|
/**
|
|
434
422
|
* Disable specific time.
|
|
435
423
|
* @template TDate
|
|
@@ -457,7 +445,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
457
445
|
* Choose which timezone to use for the value.
|
|
458
446
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
459
447
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
460
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
448
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
461
449
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
462
450
|
*/
|
|
463
451
|
timezone: PropTypes.string,
|
|
@@ -286,14 +286,6 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
286
286
|
endIndex: PropTypes.number.isRequired,
|
|
287
287
|
startIndex: PropTypes.number.isRequired
|
|
288
288
|
})]),
|
|
289
|
-
/**
|
|
290
|
-
* Disable specific clock time.
|
|
291
|
-
* @param {number} clockValue The value to check.
|
|
292
|
-
* @param {TimeView} view The clock type of the timeValue.
|
|
293
|
-
* @returns {boolean} If `true` the time will be disabled.
|
|
294
|
-
* @deprecated Consider using `shouldDisableTime`.
|
|
295
|
-
*/
|
|
296
|
-
shouldDisableClock: PropTypes.func,
|
|
297
289
|
/**
|
|
298
290
|
* Disable specific time.
|
|
299
291
|
* @template TDate
|
|
@@ -340,7 +332,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
340
332
|
* Choose which timezone to use for the value.
|
|
341
333
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
342
334
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
343
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
335
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
344
336
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
345
337
|
*/
|
|
346
338
|
timezone: PropTypes.string,
|
|
@@ -233,14 +233,6 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
233
233
|
endIndex: PropTypes.number.isRequired,
|
|
234
234
|
startIndex: PropTypes.number.isRequired
|
|
235
235
|
})]),
|
|
236
|
-
/**
|
|
237
|
-
* Disable specific clock time.
|
|
238
|
-
* @param {number} clockValue The value to check.
|
|
239
|
-
* @param {TimeView} view The clock type of the timeValue.
|
|
240
|
-
* @returns {boolean} If `true` the time will be disabled.
|
|
241
|
-
* @deprecated Consider using `shouldDisableTime`.
|
|
242
|
-
*/
|
|
243
|
-
shouldDisableClock: PropTypes.func,
|
|
244
236
|
/**
|
|
245
237
|
* Disable specific time.
|
|
246
238
|
* @template TDate
|
|
@@ -288,7 +280,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
288
280
|
* Choose which timezone to use for the value.
|
|
289
281
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
290
282
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
291
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
283
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
292
284
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
293
285
|
*/
|
|
294
286
|
timezone: PropTypes.string,
|
|
@@ -234,7 +234,7 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
234
234
|
role: "radiogroup",
|
|
235
235
|
"aria-labelledby": gridLabelId
|
|
236
236
|
}, other, {
|
|
237
|
-
children: utils.getYearRange(minDate, maxDate).map(year => {
|
|
237
|
+
children: utils.getYearRange([minDate, maxDate]).map(year => {
|
|
238
238
|
const yearNumber = utils.getYear(year);
|
|
239
239
|
const isSelected = yearNumber === selectedYear;
|
|
240
240
|
const isDisabled = disabled || isYearDisabled(year);
|
|
@@ -335,7 +335,7 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
335
335
|
* Choose which timezone to use for the value.
|
|
336
336
|
* Example: "default", "system", "UTC", "America/New_York".
|
|
337
337
|
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
338
|
-
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones
|
|
338
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
|
|
339
339
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
340
340
|
*/
|
|
341
341
|
timezone: PropTypes.string,
|
|
@@ -34,7 +34,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
34
34
|
shouldDisableMonth,
|
|
35
35
|
shouldDisableYear,
|
|
36
36
|
shouldDisableTime,
|
|
37
|
-
shouldDisableClock,
|
|
38
37
|
reduceAnimations,
|
|
39
38
|
minutesStep,
|
|
40
39
|
ampm,
|
|
@@ -42,7 +41,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
42
41
|
monthsPerRow,
|
|
43
42
|
onYearChange,
|
|
44
43
|
yearsPerRow,
|
|
45
|
-
defaultCalendarMonth,
|
|
46
44
|
slots,
|
|
47
45
|
slotProps,
|
|
48
46
|
loading,
|
|
@@ -81,7 +79,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
81
79
|
minTime,
|
|
82
80
|
maxTime,
|
|
83
81
|
shouldDisableTime,
|
|
84
|
-
shouldDisableClock,
|
|
85
82
|
minutesStep,
|
|
86
83
|
ampm,
|
|
87
84
|
slots,
|
|
@@ -120,7 +117,6 @@ export const renderDesktopDateTimeView = ({
|
|
|
120
117
|
monthsPerRow: monthsPerRow,
|
|
121
118
|
onYearChange: onYearChange,
|
|
122
119
|
yearsPerRow: yearsPerRow,
|
|
123
|
-
defaultCalendarMonth: defaultCalendarMonth,
|
|
124
120
|
slots: slots,
|
|
125
121
|
slotProps: slotProps,
|
|
126
122
|
loading: loading,
|
|
@@ -26,7 +26,6 @@ export const renderDateViewCalendar = ({
|
|
|
26
26
|
monthsPerRow,
|
|
27
27
|
onYearChange,
|
|
28
28
|
yearsPerRow,
|
|
29
|
-
defaultCalendarMonth,
|
|
30
29
|
slots,
|
|
31
30
|
slotProps,
|
|
32
31
|
loading,
|
|
@@ -65,7 +64,6 @@ export const renderDateViewCalendar = ({
|
|
|
65
64
|
monthsPerRow: monthsPerRow,
|
|
66
65
|
onYearChange: onYearChange,
|
|
67
66
|
yearsPerRow: yearsPerRow,
|
|
68
|
-
defaultCalendarMonth: defaultCalendarMonth,
|
|
69
67
|
slots: slots,
|
|
70
68
|
slotProps: slotProps,
|
|
71
69
|
loading: loading,
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v7.0.0-alpha.
|
|
2
|
+
* @mui/x-date-pickers v7.0.0-alpha.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -46,6 +46,9 @@ export * from './timeViewRenderers';
|
|
|
46
46
|
export * from './PickersLayout';
|
|
47
47
|
export * from './PickersActionBar';
|
|
48
48
|
export * from './PickersShortcuts';
|
|
49
|
+
|
|
50
|
+
// Other slots
|
|
51
|
+
export * from './PickersCalendarHeader';
|
|
49
52
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
50
53
|
export * from './models';
|
|
51
54
|
export * from './icons';
|
|
@@ -8,7 +8,7 @@ export function useNextMonthDisabled(month, {
|
|
|
8
8
|
}) {
|
|
9
9
|
const utils = useUtils();
|
|
10
10
|
return React.useMemo(() => {
|
|
11
|
-
const now = utils.
|
|
11
|
+
const now = utils.date(undefined, timezone);
|
|
12
12
|
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
|
|
13
13
|
return !utils.isAfter(lastEnabledMonth, month);
|
|
14
14
|
}, [disableFuture, maxDate, month, utils, timezone]);
|
|
@@ -20,7 +20,7 @@ export function usePreviousMonthDisabled(month, {
|
|
|
20
20
|
}) {
|
|
21
21
|
const utils = useUtils();
|
|
22
22
|
return React.useMemo(() => {
|
|
23
|
-
const now = utils.
|
|
23
|
+
const now = utils.date(undefined, timezone);
|
|
24
24
|
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
|
|
25
25
|
return !utils.isBefore(firstEnabledMonth, month);
|
|
26
26
|
}, [disablePast, minDate, month, utils, timezone]);
|
|
@@ -34,7 +34,7 @@ const getDeltaFromKeyCode = keyCode => {
|
|
|
34
34
|
};
|
|
35
35
|
export const getDaysInWeekStr = (utils, timezone, format) => {
|
|
36
36
|
const elements = [];
|
|
37
|
-
const now = utils.
|
|
37
|
+
const now = utils.date(undefined, timezone);
|
|
38
38
|
const startDate = utils.startOfWeek(now);
|
|
39
39
|
const endDate = utils.endOfWeek(now);
|
|
40
40
|
let current = startDate;
|
|
@@ -48,7 +48,7 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
|
|
|
48
48
|
switch (sectionType) {
|
|
49
49
|
case 'month':
|
|
50
50
|
{
|
|
51
|
-
return getMonthsInYear(utils, utils.
|
|
51
|
+
return getMonthsInYear(utils, utils.date(undefined, timezone)).map(month => utils.formatByString(month, format));
|
|
52
52
|
}
|
|
53
53
|
case 'weekDay':
|
|
54
54
|
{
|
|
@@ -56,7 +56,7 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
|
|
|
56
56
|
}
|
|
57
57
|
case 'meridiem':
|
|
58
58
|
{
|
|
59
|
-
const now = utils.
|
|
59
|
+
const now = utils.date(undefined, timezone);
|
|
60
60
|
return [utils.startOfDay(now), utils.endOfDay(now)].map(date => utils.formatByString(date, format));
|
|
61
61
|
}
|
|
62
62
|
default:
|
|
@@ -113,7 +113,7 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
113
113
|
let newSectionValueNumber = currentSectionValue + delta * step;
|
|
114
114
|
if (shouldSetAbsolute) {
|
|
115
115
|
if (section.type === 'year' && !isEnd && !isStart) {
|
|
116
|
-
return utils.formatByString(utils.
|
|
116
|
+
return utils.formatByString(utils.date(undefined, timezone), section.format);
|
|
117
117
|
}
|
|
118
118
|
if (delta > 0 || isStart) {
|
|
119
119
|
newSectionValueNumber = sectionBoundaries.minimum;
|
|
@@ -212,7 +212,7 @@ const getSectionPlaceholder = (utils, timezone, localeText, sectionConfig, curre
|
|
|
212
212
|
case 'year':
|
|
213
213
|
{
|
|
214
214
|
return localeText.fieldYearPlaceholder({
|
|
215
|
-
digitAmount: utils.formatByString(utils.
|
|
215
|
+
digitAmount: utils.formatByString(utils.date(undefined, timezone), currentTokenValue).length
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
case 'month':
|
|
@@ -261,12 +261,12 @@ export const changeSectionValueFormat = (utils, valueStr, currentFormat, newForm
|
|
|
261
261
|
}
|
|
262
262
|
return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
|
|
263
263
|
};
|
|
264
|
-
const isFourDigitYearFormat = (utils, timezone, format) => utils.formatByString(utils.
|
|
264
|
+
const isFourDigitYearFormat = (utils, timezone, format) => utils.formatByString(utils.date(undefined, timezone), format).length === 4;
|
|
265
265
|
export const doesSectionFormatHaveLeadingZeros = (utils, timezone, contentType, sectionType, format) => {
|
|
266
266
|
if (contentType !== 'digit') {
|
|
267
267
|
return false;
|
|
268
268
|
}
|
|
269
|
-
const now = utils.
|
|
269
|
+
const now = utils.date(undefined, timezone);
|
|
270
270
|
switch (sectionType) {
|
|
271
271
|
// We can't use `changeSectionValueFormat`, because `utils.parse('1', 'YYYY')` returns `1971` instead of `1`.
|
|
272
272
|
case 'year':
|
|
@@ -357,7 +357,6 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
357
357
|
maxLength,
|
|
358
358
|
value: sectionValue,
|
|
359
359
|
placeholder: getSectionPlaceholder(utils, timezone, localeText, sectionConfig, token),
|
|
360
|
-
hasLeadingZeros: hasLeadingZerosInFormat,
|
|
361
360
|
hasLeadingZerosInFormat,
|
|
362
361
|
hasLeadingZerosInInput,
|
|
363
362
|
startSeparator: sections.length === 0 ? startSeparator : '',
|
|
@@ -473,7 +472,7 @@ export const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
|
473
472
|
return `\u2066${dateStr}\u2069`;
|
|
474
473
|
};
|
|
475
474
|
export const getSectionsBoundaries = (utils, timezone) => {
|
|
476
|
-
const today = utils.
|
|
475
|
+
const today = utils.date(undefined, timezone);
|
|
477
476
|
const endOfYear = utils.endOfYear(today);
|
|
478
477
|
const endOfDay = utils.endOfDay(today);
|
|
479
478
|
const {
|
|
@@ -156,7 +156,7 @@ export const useFieldState = params => {
|
|
|
156
156
|
const nonEmptySectionCountBefore = activeDateManager.getSections(state.sections).filter(section => section.value !== '').length;
|
|
157
157
|
const hasNoOtherNonEmptySections = nonEmptySectionCountBefore === (activeSection.value === '' ? 0 : 1);
|
|
158
158
|
const newSections = setSectionValue(selectedSectionIndexes.startIndex, '');
|
|
159
|
-
const newActiveDate = hasNoOtherNonEmptySections ? null : utils.
|
|
159
|
+
const newActiveDate = hasNoOtherNonEmptySections ? null : utils.getInvalidDate();
|
|
160
160
|
const newValues = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
|
|
161
161
|
if ((newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date))) {
|
|
162
162
|
publishValue(_extends({}, newValues, {
|
|
@@ -249,7 +249,7 @@ export const useFieldState = params => {
|
|
|
249
249
|
}, [format, utils.locale]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
250
250
|
|
|
251
251
|
React.useEffect(() => {
|
|
252
|
-
let shouldUpdate
|
|
252
|
+
let shouldUpdate;
|
|
253
253
|
if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
|
|
254
254
|
shouldUpdate = true;
|
|
255
255
|
} else {
|
|
@@ -22,7 +22,7 @@ export const useNow = timezone => {
|
|
|
22
22
|
const utils = useUtils();
|
|
23
23
|
const now = React.useRef();
|
|
24
24
|
if (now.current === undefined) {
|
|
25
|
-
now.current = utils.
|
|
25
|
+
now.current = utils.date(undefined, timezone);
|
|
26
26
|
}
|
|
27
27
|
return now.current;
|
|
28
28
|
};
|
|
@@ -83,7 +83,7 @@ export function useViews({
|
|
|
83
83
|
const isSelectionFinishedOnCurrentView = currentViewSelectionState === 'finish';
|
|
84
84
|
const hasMoreViews = selectedView ?
|
|
85
85
|
// handles case like `DateTimePicker`, where a view might return a `finish` selection state
|
|
86
|
-
// but
|
|
86
|
+
// but when it's not the final view given all `views` -> overall selection state should be `partial`.
|
|
87
87
|
views.indexOf(selectedView) < views.length - 1 : Boolean(nextView);
|
|
88
88
|
const globalSelectionState = isSelectionFinishedOnCurrentView && hasMoreViews ? 'partial' : currentViewSelectionState;
|
|
89
89
|
onChange(value, globalSelectionState);
|
|
@@ -105,7 +105,7 @@ export function useViews({
|
|
|
105
105
|
setFocusedView: handleFocusedViewChange,
|
|
106
106
|
nextView,
|
|
107
107
|
previousView,
|
|
108
|
-
// Always return up
|
|
108
|
+
// Always return up-to-date default view instead of the initial one (i.e. defaultView.current)
|
|
109
109
|
defaultView: views.includes(openTo) ? openTo : views[0],
|
|
110
110
|
goToNextView,
|
|
111
111
|
setValueAndGoToNextView,
|
|
@@ -9,7 +9,7 @@ export const findClosestEnabledDate = ({
|
|
|
9
9
|
utils,
|
|
10
10
|
timezone
|
|
11
11
|
}) => {
|
|
12
|
-
const today = utils.startOfDay(utils.
|
|
12
|
+
const today = utils.startOfDay(utils.date(undefined, timezone));
|
|
13
13
|
if (disablePast && utils.isBefore(minDate, today)) {
|
|
14
14
|
minDate = today;
|
|
15
15
|
}
|
|
@@ -79,7 +79,7 @@ export const mergeDateAndTime = (utils, dateParam, timeParam) => {
|
|
|
79
79
|
mergedDate = utils.setSeconds(mergedDate, utils.getSeconds(timeParam));
|
|
80
80
|
return mergedDate;
|
|
81
81
|
};
|
|
82
|
-
export const getTodayDate = (utils, timezone, valueType) => valueType === 'date' ? utils.startOfDay(utils.
|
|
82
|
+
export const getTodayDate = (utils, timezone, valueType) => valueType === 'date' ? utils.startOfDay(utils.date(undefined, timezone)) : utils.date(undefined, timezone);
|
|
83
83
|
export const formatMeridiem = (utils, meridiem) => {
|
|
84
84
|
const date = utils.setHours(utils.date(), meridiem === 'am' ? 2 : 14);
|
|
85
85
|
return utils.format(date, 'meridiem');
|
|
@@ -10,7 +10,6 @@ export const SECTION_TYPE_GRANULARITY = {
|
|
|
10
10
|
milliseconds: 7
|
|
11
11
|
};
|
|
12
12
|
export const getSectionTypeGranularity = sections => Math.max(...sections.map(section => SECTION_TYPE_GRANULARITY[section.type] ?? 1));
|
|
13
|
-
export const getViewsGranularity = views => Math.max(...views.map(view => SECTION_TYPE_GRANULARITY[view] ?? 1));
|
|
14
13
|
const roundDate = (utils, granularity, date) => {
|
|
15
14
|
if (granularity === SECTION_TYPE_GRANULARITY.year) {
|
|
16
15
|
return utils.startOfYear(date);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const DATE_VALIDATION_PROP_NAMES = ['disablePast', 'disableFuture', 'minDate', 'maxDate', 'shouldDisableDate', 'shouldDisableMonth', 'shouldDisableYear'];
|
|
2
|
-
export const TIME_VALIDATION_PROP_NAMES = ['disablePast', 'disableFuture', 'minTime', 'maxTime', '
|
|
2
|
+
export const TIME_VALIDATION_PROP_NAMES = ['disablePast', 'disableFuture', 'minTime', 'maxTime', 'shouldDisableTime', 'minutesStep', 'ampm', 'disableIgnoringDatePartForTimeValidation'];
|
|
3
3
|
export const DATE_TIME_VALIDATION_PROP_NAMES = ['minDateTime', 'maxDateTime'];
|
|
4
4
|
const VALIDATION_PROP_NAMES = [...DATE_VALIDATION_PROP_NAMES, ...TIME_VALIDATION_PROP_NAMES, ...DATE_TIME_VALIDATION_PROP_NAMES];
|
|
5
5
|
/**
|
|
@@ -15,7 +15,7 @@ export const validateDate = ({
|
|
|
15
15
|
disableFuture,
|
|
16
16
|
timezone
|
|
17
17
|
} = props;
|
|
18
|
-
const now = adapter.utils.
|
|
18
|
+
const now = adapter.utils.date(undefined, timezone);
|
|
19
19
|
const minDate = applyDefaultDate(adapter.utils, props.minDate, adapter.defaultDates.minDate);
|
|
20
20
|
const maxDate = applyDefaultDate(adapter.utils, props.maxDate, adapter.defaultDates.maxDate);
|
|
21
21
|
switch (true) {
|
|
@@ -11,14 +11,13 @@ export const validateTime = ({
|
|
|
11
11
|
minTime,
|
|
12
12
|
maxTime,
|
|
13
13
|
minutesStep,
|
|
14
|
-
shouldDisableClock,
|
|
15
14
|
shouldDisableTime,
|
|
16
15
|
disableIgnoringDatePartForTimeValidation = false,
|
|
17
16
|
disablePast,
|
|
18
17
|
disableFuture,
|
|
19
18
|
timezone
|
|
20
19
|
} = props;
|
|
21
|
-
const now = adapter.utils.
|
|
20
|
+
const now = adapter.utils.date(undefined, timezone);
|
|
22
21
|
const isAfter = createIsAfterIgnoreDatePart(disableIgnoringDatePartForTimeValidation, adapter.utils);
|
|
23
22
|
switch (true) {
|
|
24
23
|
case !adapter.utils.isValid(value):
|
|
@@ -37,12 +36,6 @@ export const validateTime = ({
|
|
|
37
36
|
return 'shouldDisableTime-minutes';
|
|
38
37
|
case Boolean(shouldDisableTime && shouldDisableTime(value, 'seconds')):
|
|
39
38
|
return 'shouldDisableTime-seconds';
|
|
40
|
-
case Boolean(shouldDisableClock && shouldDisableClock(adapter.utils.getHours(value), 'hours')):
|
|
41
|
-
return 'shouldDisableClock-hours';
|
|
42
|
-
case Boolean(shouldDisableClock && shouldDisableClock(adapter.utils.getMinutes(value), 'minutes')):
|
|
43
|
-
return 'shouldDisableClock-minutes';
|
|
44
|
-
case Boolean(shouldDisableClock && shouldDisableClock(adapter.utils.getSeconds(value), 'seconds')):
|
|
45
|
-
return 'shouldDisableClock-seconds';
|
|
46
39
|
case Boolean(minutesStep && adapter.utils.getMinutes(value) % minutesStep !== 0):
|
|
47
40
|
return 'minutesStep';
|
|
48
41
|
default:
|
package/modern/locales/deDE.js
CHANGED
|
@@ -42,8 +42,7 @@ const deDEPickers = {
|
|
|
42
42
|
// Open picker labels
|
|
43
43
|
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Datum auswählen, gewähltes Datum ist ${utils.format(value, 'fullDate')}` : 'Datum auswählen',
|
|
44
44
|
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Uhrzeit auswählen, gewählte Uhrzeit ist ${utils.format(value, 'fullTime')}` : 'Uhrzeit auswählen',
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
fieldClearLabel: 'Wert leeren',
|
|
47
46
|
// Table labels
|
|
48
47
|
timeTableLabel: 'Uhrzeit auswählen',
|
|
49
48
|
dateTableLabel: 'Datum auswählen',
|
|
@@ -51,7 +50,7 @@ const deDEPickers = {
|
|
|
51
50
|
fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
|
|
52
51
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
53
52
|
fieldDayPlaceholder: () => 'TT',
|
|
54
|
-
|
|
53
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
55
54
|
fieldHoursPlaceholder: () => 'hh',
|
|
56
55
|
fieldMinutesPlaceholder: () => 'mm',
|
|
57
56
|
fieldSecondsPlaceholder: () => 'ss',
|