@mui/x-date-pickers 8.5.2 → 8.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.md +203 -11
  2. package/DateCalendar/DateCalendar.js +16 -16
  3. package/DateCalendar/DayCalendar.js +48 -48
  4. package/DateCalendar/useCalendarState.js +25 -25
  5. package/DateCalendar/useIsDateDisabled.js +2 -2
  6. package/DatePicker/DatePickerToolbar.js +7 -9
  7. package/DateTimeField/DateTimeField.js +1 -1
  8. package/DateTimePicker/DateTimePicker.js +1 -1
  9. package/DateTimePicker/DateTimePickerToolbar.js +12 -13
  10. package/DateTimePicker/shared.js +3 -3
  11. package/DesktopDatePicker/DesktopDatePicker.js +3 -3
  12. package/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -4
  13. package/DesktopTimePicker/DesktopTimePicker.js +4 -4
  14. package/DigitalClock/DigitalClock.d.ts +1 -1
  15. package/DigitalClock/DigitalClock.js +16 -16
  16. package/LocalizationProvider/LocalizationProvider.d.ts +9 -3
  17. package/LocalizationProvider/LocalizationProvider.js +28 -19
  18. package/MobileDatePicker/MobileDatePicker.js +3 -3
  19. package/MobileDateTimePicker/MobileDateTimePicker.js +4 -4
  20. package/MobileTimePicker/MobileTimePicker.js +4 -4
  21. package/MonthCalendar/MonthCalendar.js +19 -18
  22. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +32 -32
  23. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +4 -4
  24. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +7 -7
  25. package/PickerDay2/PickerDay2.js +3 -3
  26. package/PickersActionBar/PickersActionBar.d.ts +2 -2
  27. package/PickersActionBar/PickersActionBar.js +2 -2
  28. package/PickersCalendarHeader/PickersCalendarHeader.js +7 -8
  29. package/PickersDay/PickersDay.js +3 -3
  30. package/PickersDay/usePickerDayOwnerState.js +5 -5
  31. package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +1 -0
  32. package/PickersTextField/PickersInput/pickersInputClasses.d.ts +1 -0
  33. package/PickersTextField/PickersInputBase/pickersInputBaseClasses.d.ts +2 -0
  34. package/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +1 -1
  35. package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.d.ts +1 -0
  36. package/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
  37. package/StaticTimePicker/StaticTimePicker.js +1 -1
  38. package/TimeClock/Clock.js +8 -9
  39. package/TimeClock/ClockNumbers.d.ts +3 -3
  40. package/TimeClock/ClockNumbers.js +5 -5
  41. package/TimeClock/TimeClock.js +29 -29
  42. package/TimeField/TimeField.js +1 -1
  43. package/TimePicker/TimePicker.js +1 -1
  44. package/TimePicker/TimePickerToolbar.js +7 -9
  45. package/TimePicker/shared.js +3 -3
  46. package/YearCalendar/YearCalendar.js +19 -18
  47. package/esm/DateCalendar/DateCalendar.js +16 -16
  48. package/esm/DateCalendar/DayCalendar.js +48 -48
  49. package/esm/DateCalendar/useCalendarState.js +25 -25
  50. package/esm/DateCalendar/useIsDateDisabled.js +2 -2
  51. package/esm/DatePicker/DatePickerToolbar.js +6 -8
  52. package/esm/DateTimeField/DateTimeField.js +1 -1
  53. package/esm/DateTimePicker/DateTimePicker.js +1 -1
  54. package/esm/DateTimePicker/DateTimePickerToolbar.js +11 -12
  55. package/esm/DateTimePicker/shared.js +3 -3
  56. package/esm/DesktopDatePicker/DesktopDatePicker.js +3 -3
  57. package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -4
  58. package/esm/DesktopTimePicker/DesktopTimePicker.js +4 -4
  59. package/esm/DigitalClock/DigitalClock.d.ts +1 -1
  60. package/esm/DigitalClock/DigitalClock.js +16 -16
  61. package/esm/LocalizationProvider/LocalizationProvider.d.ts +9 -3
  62. package/esm/LocalizationProvider/LocalizationProvider.js +27 -18
  63. package/esm/MobileDatePicker/MobileDatePicker.js +3 -3
  64. package/esm/MobileDateTimePicker/MobileDateTimePicker.js +4 -4
  65. package/esm/MobileTimePicker/MobileTimePicker.js +4 -4
  66. package/esm/MonthCalendar/MonthCalendar.js +20 -19
  67. package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.js +32 -32
  68. package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +4 -4
  69. package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +7 -7
  70. package/esm/PickerDay2/PickerDay2.js +3 -3
  71. package/esm/PickersActionBar/PickersActionBar.d.ts +2 -2
  72. package/esm/PickersActionBar/PickersActionBar.js +2 -2
  73. package/esm/PickersCalendarHeader/PickersCalendarHeader.js +6 -7
  74. package/esm/PickersDay/PickersDay.js +3 -3
  75. package/esm/PickersDay/usePickerDayOwnerState.js +5 -5
  76. package/esm/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +1 -0
  77. package/esm/PickersTextField/PickersInput/pickersInputClasses.d.ts +1 -0
  78. package/esm/PickersTextField/PickersInputBase/pickersInputBaseClasses.d.ts +2 -0
  79. package/esm/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +1 -1
  80. package/esm/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.d.ts +1 -0
  81. package/esm/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
  82. package/esm/StaticTimePicker/StaticTimePicker.js +1 -1
  83. package/esm/TimeClock/Clock.js +7 -8
  84. package/esm/TimeClock/ClockNumbers.d.ts +3 -3
  85. package/esm/TimeClock/ClockNumbers.js +5 -5
  86. package/esm/TimeClock/TimeClock.js +29 -29
  87. package/esm/TimeField/TimeField.js +1 -1
  88. package/esm/TimePicker/TimePicker.js +1 -1
  89. package/esm/TimePicker/TimePickerToolbar.js +6 -8
  90. package/esm/TimePicker/shared.js +3 -3
  91. package/esm/YearCalendar/YearCalendar.js +20 -19
  92. package/esm/hooks/index.d.ts +2 -1
  93. package/esm/hooks/index.js +2 -1
  94. package/esm/hooks/useParsedFormat.js +6 -6
  95. package/esm/hooks/usePickerAdapter.d.ts +7 -0
  96. package/esm/hooks/usePickerAdapter.js +20 -0
  97. package/esm/hooks/usePickerTranslations.js +1 -1
  98. package/esm/index.js +1 -1
  99. package/esm/internals/components/pickersToolbarClasses.d.ts +1 -1
  100. package/esm/internals/demo/DemoContainer.d.ts +2 -3
  101. package/esm/internals/demo/DemoContainer.js +3 -2
  102. package/esm/internals/hooks/date-helpers-hooks.js +16 -16
  103. package/esm/internals/hooks/useClockReferenceDate.d.ts +2 -2
  104. package/esm/internals/hooks/useClockReferenceDate.js +3 -3
  105. package/esm/internals/hooks/useControlledValue.js +8 -7
  106. package/esm/internals/hooks/useField/buildSectionsFromFormat.d.ts +1 -1
  107. package/esm/internals/hooks/useField/buildSectionsFromFormat.js +17 -17
  108. package/esm/internals/hooks/useField/useField.types.d.ts +2 -2
  109. package/esm/internals/hooks/useField/useField.utils.d.ts +10 -10
  110. package/esm/internals/hooks/useField/useField.utils.js +69 -69
  111. package/esm/internals/hooks/useField/useFieldCharacterEditing.js +11 -11
  112. package/esm/internals/hooks/useField/useFieldRootHandleKeyDown.js +7 -7
  113. package/esm/internals/hooks/useField/useFieldSectionContentProps.js +15 -16
  114. package/esm/internals/hooks/useField/useFieldState.js +22 -24
  115. package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +6 -6
  116. package/esm/internals/hooks/usePicker/usePicker.js +5 -6
  117. package/esm/internals/hooks/useUtils.d.ts +1 -8
  118. package/esm/internals/hooks/useUtils.js +3 -19
  119. package/esm/internals/index.d.ts +2 -1
  120. package/esm/internals/index.js +2 -1
  121. package/esm/internals/models/manager.d.ts +14 -14
  122. package/esm/internals/models/props/time.d.ts +1 -1
  123. package/esm/internals/utils/date-time-utils.d.ts +1 -1
  124. package/esm/internals/utils/date-time-utils.js +5 -5
  125. package/esm/internals/utils/date-utils.d.ts +11 -11
  126. package/esm/internals/utils/date-utils.js +34 -34
  127. package/esm/internals/utils/getDefaultReferenceDate.d.ts +2 -2
  128. package/esm/internals/utils/getDefaultReferenceDate.js +16 -16
  129. package/esm/internals/utils/time-utils.d.ts +5 -5
  130. package/esm/internals/utils/time-utils.js +12 -12
  131. package/esm/internals/utils/valueManagers.js +4 -4
  132. package/esm/managers/useDateManager.js +12 -12
  133. package/esm/managers/useDateTimeManager.js +13 -13
  134. package/esm/managers/useTimeManager.js +9 -10
  135. package/esm/validation/useValidation.d.ts +2 -3
  136. package/esm/validation/useValidation.js +2 -2
  137. package/esm/validation/validateDate.js +6 -6
  138. package/esm/validation/validateTime.js +6 -6
  139. package/hooks/index.d.ts +2 -1
  140. package/hooks/index.js +8 -1
  141. package/hooks/useParsedFormat.js +6 -6
  142. package/hooks/usePickerAdapter.d.ts +7 -0
  143. package/hooks/usePickerAdapter.js +29 -0
  144. package/hooks/usePickerTranslations.js +2 -2
  145. package/index.js +1 -1
  146. package/internals/components/pickersToolbarClasses.d.ts +1 -1
  147. package/internals/demo/DemoContainer.d.ts +2 -3
  148. package/internals/demo/DemoContainer.js +3 -2
  149. package/internals/hooks/date-helpers-hooks.js +16 -16
  150. package/internals/hooks/useClockReferenceDate.d.ts +2 -2
  151. package/internals/hooks/useClockReferenceDate.js +3 -3
  152. package/internals/hooks/useControlledValue.js +7 -7
  153. package/internals/hooks/useField/buildSectionsFromFormat.d.ts +1 -1
  154. package/internals/hooks/useField/buildSectionsFromFormat.js +17 -17
  155. package/internals/hooks/useField/useField.types.d.ts +2 -2
  156. package/internals/hooks/useField/useField.utils.d.ts +10 -10
  157. package/internals/hooks/useField/useField.utils.js +69 -69
  158. package/internals/hooks/useField/useFieldCharacterEditing.js +11 -11
  159. package/internals/hooks/useField/useFieldRootHandleKeyDown.js +7 -7
  160. package/internals/hooks/useField/useFieldSectionContentProps.js +14 -15
  161. package/internals/hooks/useField/useFieldState.js +23 -25
  162. package/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +6 -6
  163. package/internals/hooks/usePicker/usePicker.js +5 -6
  164. package/internals/hooks/useUtils.d.ts +1 -8
  165. package/internals/hooks/useUtils.js +5 -24
  166. package/internals/index.d.ts +2 -1
  167. package/internals/index.js +2 -7
  168. package/internals/models/manager.d.ts +14 -14
  169. package/internals/models/props/time.d.ts +1 -1
  170. package/internals/utils/date-time-utils.d.ts +1 -1
  171. package/internals/utils/date-time-utils.js +5 -5
  172. package/internals/utils/date-utils.d.ts +11 -11
  173. package/internals/utils/date-utils.js +34 -34
  174. package/internals/utils/getDefaultReferenceDate.d.ts +2 -2
  175. package/internals/utils/getDefaultReferenceDate.js +16 -16
  176. package/internals/utils/time-utils.d.ts +5 -5
  177. package/internals/utils/time-utils.js +12 -12
  178. package/internals/utils/valueManagers.js +4 -4
  179. package/managers/useDateManager.js +12 -12
  180. package/managers/useDateTimeManager.js +13 -13
  181. package/managers/useTimeManager.js +10 -11
  182. package/package.json +2 -2
  183. package/validation/useValidation.d.ts +2 -3
  184. package/validation/useValidation.js +2 -2
  185. package/validation/validateDate.js +6 -6
  186. package/validation/validateTime.js +6 -6
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import useEventCallback from '@mui/utils/useEventCallback';
3
3
  import useControlled from '@mui/utils/useControlled';
4
- import { useUtils } from "./useUtils.js";
4
+ import { usePickerAdapter } from "../../hooks/usePickerAdapter.js";
5
+
5
6
  /**
6
7
  * Hooks controlling the value while making sure that:
7
8
  * - The value returned by `onChange` always have the timezone of `props.value` or `props.defaultValue` if defined
@@ -16,19 +17,19 @@ export const useControlledValue = ({
16
17
  onChange: onChangeProp,
17
18
  valueManager
18
19
  }) => {
19
- const utils = useUtils();
20
+ const adapter = usePickerAdapter();
20
21
  const [valueWithInputTimezone, setValue] = useControlled({
21
22
  name,
22
23
  state: 'value',
23
24
  controlled: valueProp,
24
25
  default: defaultValue ?? valueManager.emptyValue
25
26
  });
26
- const inputTimezone = React.useMemo(() => valueManager.getTimezone(utils, valueWithInputTimezone), [utils, valueManager, valueWithInputTimezone]);
27
+ const inputTimezone = React.useMemo(() => valueManager.getTimezone(adapter, valueWithInputTimezone), [adapter, valueManager, valueWithInputTimezone]);
27
28
  const setInputTimezone = useEventCallback(newValue => {
28
29
  if (inputTimezone == null) {
29
30
  return newValue;
30
31
  }
31
- return valueManager.setTimezone(utils, inputTimezone, newValue);
32
+ return valueManager.setTimezone(adapter, inputTimezone, newValue);
32
33
  });
33
34
  const timezoneToRender = React.useMemo(() => {
34
35
  if (timezoneProp) {
@@ -38,11 +39,11 @@ export const useControlledValue = ({
38
39
  return inputTimezone;
39
40
  }
40
41
  if (referenceDate) {
41
- return utils.getTimezone(referenceDate);
42
+ return adapter.getTimezone(referenceDate);
42
43
  }
43
44
  return 'default';
44
- }, [timezoneProp, inputTimezone, referenceDate, utils]);
45
- const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, valueWithInputTimezone), [valueManager, utils, timezoneToRender, valueWithInputTimezone]);
45
+ }, [timezoneProp, inputTimezone, referenceDate, adapter]);
46
+ const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(adapter, timezoneToRender, valueWithInputTimezone), [valueManager, adapter, timezoneToRender, valueWithInputTimezone]);
46
47
  const handleValueChange = useEventCallback((newValue, ...otherParams) => {
47
48
  const newValueWithInputTimezone = setInputTimezone(newValue);
48
49
  setValue(newValueWithInputTimezone);
@@ -1,7 +1,7 @@
1
1
  import { FieldSection, MuiPickersAdapter, PickerValidDate } from "../../../models/index.js";
2
2
  import { PickersLocaleText } from "../../../locales/index.js";
3
3
  interface BuildSectionsFromFormatParameters {
4
- utils: MuiPickersAdapter;
4
+ adapter: MuiPickersAdapter;
5
5
  format: string;
6
6
  formatDensity: 'dense' | 'spacious';
7
7
  isRtl: boolean;
@@ -1,16 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { applyLocalizedDigits, cleanLeadingZeros, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, removeLocalizedDigits } from "./useField.utils.js";
3
3
  const expandFormat = ({
4
- utils,
4
+ adapter,
5
5
  format
6
6
  }) => {
7
7
  // Expand the provided format
8
8
  let formatExpansionOverflow = 10;
9
9
  let prevFormat = format;
10
- let nextFormat = utils.expandFormat(format);
10
+ let nextFormat = adapter.expandFormat(format);
11
11
  while (nextFormat !== prevFormat) {
12
12
  prevFormat = nextFormat;
13
- nextFormat = utils.expandFormat(prevFormat);
13
+ nextFormat = adapter.expandFormat(prevFormat);
14
14
  formatExpansionOverflow -= 1;
15
15
  if (formatExpansionOverflow < 0) {
16
16
  throw new Error('MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the component.');
@@ -19,14 +19,14 @@ const expandFormat = ({
19
19
  return nextFormat;
20
20
  };
21
21
  const getEscapedPartsFromFormat = ({
22
- utils,
22
+ adapter,
23
23
  expandedFormat
24
24
  }) => {
25
25
  const escapedParts = [];
26
26
  const {
27
27
  start: startChar,
28
28
  end: endChar
29
- } = utils.escapedCharacters;
29
+ } = adapter.escapedCharacters;
30
30
  const regExp = new RegExp(`(\\${startChar}[^\\${endChar}]*\\${endChar})+`, 'g');
31
31
  let match = null;
32
32
  // eslint-disable-next-line no-cond-assign
@@ -38,12 +38,12 @@ const getEscapedPartsFromFormat = ({
38
38
  }
39
39
  return escapedParts;
40
40
  };
41
- const getSectionPlaceholder = (utils, localeText, sectionConfig, sectionFormat) => {
41
+ const getSectionPlaceholder = (adapter, localeText, sectionConfig, sectionFormat) => {
42
42
  switch (sectionConfig.type) {
43
43
  case 'year':
44
44
  {
45
45
  return localeText.fieldYearPlaceholder({
46
- digitAmount: utils.formatByString(utils.date(undefined, 'default'), sectionFormat).length,
46
+ digitAmount: adapter.formatByString(adapter.date(undefined, 'default'), sectionFormat).length,
47
47
  format: sectionFormat
48
48
  });
49
49
  }
@@ -98,7 +98,7 @@ const getSectionPlaceholder = (utils, localeText, sectionConfig, sectionFormat)
98
98
  }
99
99
  };
100
100
  const createSection = ({
101
- utils,
101
+ adapter,
102
102
  date,
103
103
  shouldRespectLeadingZeros,
104
104
  localeText,
@@ -110,15 +110,15 @@ const createSection = ({
110
110
  if (token === '') {
111
111
  throw new Error('MUI X: Should not call `commitToken` with an empty token');
112
112
  }
113
- const sectionConfig = getDateSectionConfigFromFormatToken(utils, token);
114
- const hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(utils, sectionConfig.contentType, sectionConfig.type, token);
113
+ const sectionConfig = getDateSectionConfigFromFormatToken(adapter, token);
114
+ const hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(adapter, sectionConfig.contentType, sectionConfig.type, token);
115
115
  const hasLeadingZerosInInput = shouldRespectLeadingZeros ? hasLeadingZerosInFormat : sectionConfig.contentType === 'digit';
116
- const isValidDate = utils.isValid(date);
117
- let sectionValue = isValidDate ? utils.formatByString(date, token) : '';
116
+ const isValidDate = adapter.isValid(date);
117
+ let sectionValue = isValidDate ? adapter.formatByString(date, token) : '';
118
118
  let maxLength = null;
119
119
  if (hasLeadingZerosInInput) {
120
120
  if (hasLeadingZerosInFormat) {
121
- maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
121
+ maxLength = sectionValue === '' ? adapter.formatByString(now, token).length : sectionValue.length;
122
122
  } else {
123
123
  if (sectionConfig.maxLength == null) {
124
124
  throw new Error(`MUI X: The token ${token} should have a 'maxLength' property on it's adapter`);
@@ -133,7 +133,7 @@ const createSection = ({
133
133
  format: token,
134
134
  maxLength,
135
135
  value: sectionValue,
136
- placeholder: getSectionPlaceholder(utils, localeText, sectionConfig, token),
136
+ placeholder: getSectionPlaceholder(adapter, localeText, sectionConfig, token),
137
137
  hasLeadingZerosInFormat,
138
138
  hasLeadingZerosInInput,
139
139
  startSeparator,
@@ -143,16 +143,16 @@ const createSection = ({
143
143
  };
144
144
  const buildSections = parameters => {
145
145
  const {
146
- utils,
146
+ adapter,
147
147
  expandedFormat,
148
148
  escapedParts
149
149
  } = parameters;
150
- const now = utils.date(undefined);
150
+ const now = adapter.date(undefined);
151
151
  const sections = [];
152
152
  let startSeparator = '';
153
153
 
154
154
  // This RegExp tests if the beginning of a string corresponds to a supported token
155
- const validTokens = Object.keys(utils.formatTokenMap).sort((a, b) => b.length - a.length); // Sort to put longest word first
155
+ const validTokens = Object.keys(adapter.formatTokenMap).sort((a, b) => b.length - a.length); // Sort to put longest word first
156
156
 
157
157
  const regExpFirstWordInFormat = /^([a-zA-Z]+)/;
158
158
  const regExpWordOnlyComposedOfTokens = new RegExp(`^(${validTokens.join('|')})*$`);
@@ -201,12 +201,12 @@ export interface FieldValueManager<TValue extends PickerValidValue> {
201
201
  * Update the reference value with the new value.
202
202
  * This method must make sure that no date inside the returned `referenceValue` is invalid.
203
203
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
204
- * @param {MuiPickersAdapter} utils The utils to manipulate the date.
204
+ * @param {MuiPickersAdapter} adapter The adapter to manipulate the date.
205
205
  * @param {TValue} value The new value from which we want to take all valid dates in the `referenceValue` state.
206
206
  * @param {TValue} prevReferenceValue The previous reference value. It is used as a fallback for invalid dates in the new value.
207
207
  * @returns {TValue} The new reference value with no invalid date.
208
208
  */
209
- updateReferenceValue: (utils: MuiPickersAdapter, value: TValue, prevReferenceValue: InferNonNullablePickerValue<TValue>) => InferNonNullablePickerValue<TValue>;
209
+ updateReferenceValue: (adapter: MuiPickersAdapter, value: TValue, prevReferenceValue: InferNonNullablePickerValue<TValue>) => InferNonNullablePickerValue<TValue>;
210
210
  /**
211
211
  * Extract from the given value the date that contains the given section.
212
212
  * @param {TValue} value The value to extract the date from.
@@ -1,13 +1,13 @@
1
1
  import { FieldSectionsValueBoundaries, SectionOrdering, FieldSectionValueBoundaries, FieldParsedSelectedSections } from "./useField.types.js";
2
2
  import { FieldSectionType, FieldSection, MuiPickersAdapter, FieldSectionContentType, PickersTimezone, PickerValidDate, FieldSelectedSections, PickerValueType, InferFieldSection } from "../../../models/index.js";
3
3
  import { PickerValidValue } from "../../models/index.js";
4
- export declare const getDateSectionConfigFromFormatToken: (utils: MuiPickersAdapter, formatToken: string) => Pick<FieldSection, "type" | "contentType"> & {
4
+ export declare const getDateSectionConfigFromFormatToken: (adapter: MuiPickersAdapter, formatToken: string) => Pick<FieldSection, "type" | "contentType"> & {
5
5
  maxLength: number | undefined;
6
6
  };
7
- export declare const getDaysInWeekStr: (utils: MuiPickersAdapter, format: string) => string[];
8
- export declare const getLetterEditingOptions: (utils: MuiPickersAdapter, timezone: PickersTimezone, sectionType: FieldSectionType, format: string) => string[];
7
+ export declare const getDaysInWeekStr: (adapter: MuiPickersAdapter, format: string) => string[];
8
+ export declare const getLetterEditingOptions: (adapter: MuiPickersAdapter, timezone: PickersTimezone, sectionType: FieldSectionType, format: string) => string[];
9
9
  export declare const FORMAT_SECONDS_NO_LEADING_ZEROS = "s";
10
- export declare const getLocalizedDigits: (utils: MuiPickersAdapter) => string[];
10
+ export declare const getLocalizedDigits: (adapter: MuiPickersAdapter) => string[];
11
11
  export declare const removeLocalizedDigits: (valueStr: string, localizedDigits: string[]) => string;
12
12
  export declare const applyLocalizedDigits: (valueStr: string, localizedDigits: string[]) => string;
13
13
  export declare const isStringNumber: (valueStr: string, localizedDigits: string[]) => boolean;
@@ -17,20 +17,20 @@ export declare const isStringNumber: (valueStr: string, localizedDigits: string[
17
17
  * Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
18
18
  */
19
19
  export declare const cleanLeadingZeros: (valueStr: string, size: number) => string;
20
- export declare const cleanDigitSectionValue: (utils: MuiPickersAdapter, value: number, sectionBoundaries: FieldSectionValueBoundaries<any>, localizedDigits: string[], section: Pick<FieldSection, "format" | "type" | "contentType" | "hasLeadingZerosInFormat" | "hasLeadingZerosInInput" | "maxLength">) => string;
20
+ export declare const cleanDigitSectionValue: (adapter: MuiPickersAdapter, value: number, sectionBoundaries: FieldSectionValueBoundaries<any>, localizedDigits: string[], section: Pick<FieldSection, "format" | "type" | "contentType" | "hasLeadingZerosInFormat" | "hasLeadingZerosInInput" | "maxLength">) => string;
21
21
  export declare const getSectionVisibleValue: (section: FieldSection, target: "input-rtl" | "input-ltr" | "non-input", localizedDigits: string[]) => string;
22
- export declare const changeSectionValueFormat: (utils: MuiPickersAdapter, valueStr: string, currentFormat: string, newFormat: string) => string;
23
- export declare const doesSectionFormatHaveLeadingZeros: (utils: MuiPickersAdapter, contentType: FieldSectionContentType, sectionType: FieldSectionType, format: string) => boolean;
22
+ export declare const changeSectionValueFormat: (adapter: MuiPickersAdapter, valueStr: string, currentFormat: string, newFormat: string) => string;
23
+ export declare const doesSectionFormatHaveLeadingZeros: (adapter: MuiPickersAdapter, contentType: FieldSectionContentType, sectionType: FieldSectionType, format: string) => boolean;
24
24
  /**
25
25
  * Some date libraries like `dayjs` don't support parsing from date with escaped characters.
26
26
  * To make sure that the parsing works, we are building a format and a date without any separator.
27
27
  */
28
- export declare const getDateFromDateSections: (utils: MuiPickersAdapter, sections: FieldSection[], localizedDigits: string[]) => PickerValidDate;
28
+ export declare const getDateFromDateSections: (adapter: MuiPickersAdapter, sections: FieldSection[], localizedDigits: string[]) => PickerValidDate;
29
29
  export declare const createDateStrForV7HiddenInputFromSections: (sections: FieldSection[]) => string;
30
30
  export declare const createDateStrForV6InputFromSections: (sections: FieldSection[], localizedDigits: string[], isRtl: boolean) => string;
31
- export declare const getSectionsBoundaries: (utils: MuiPickersAdapter, localizedDigits: string[], timezone: PickersTimezone) => FieldSectionsValueBoundaries;
31
+ export declare const getSectionsBoundaries: (adapter: MuiPickersAdapter, localizedDigits: string[], timezone: PickersTimezone) => FieldSectionsValueBoundaries;
32
32
  export declare const validateSections: <TValue extends PickerValidValue>(sections: InferFieldSection<TValue>[], valueType: PickerValueType) => void;
33
- export declare const mergeDateIntoReferenceDate: (utils: MuiPickersAdapter, dateToTransferFrom: PickerValidDate, sections: FieldSection[], referenceDate: PickerValidDate, shouldLimitToEditedSections: boolean) => PickerValidDate;
33
+ export declare const mergeDateIntoReferenceDate: (adapter: MuiPickersAdapter, dateToTransferFrom: PickerValidDate, sections: FieldSection[], referenceDate: PickerValidDate, shouldLimitToEditedSections: boolean) => PickerValidDate;
34
34
  export declare const isAndroid: () => boolean;
35
35
  export declare const getSectionOrder: (sections: FieldSection[], shouldApplyRTL: boolean) => SectionOrdering;
36
36
  export declare const parseSelectedSections: (selectedSections: FieldSelectedSections, sections: FieldSection[]) => FieldParsedSelectedSections;
@@ -1,6 +1,6 @@
1
1
  import { getMonthsInYear } from "../../utils/date-utils.js";
2
- export const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
3
- const config = utils.formatTokenMap[formatToken];
2
+ export const getDateSectionConfigFromFormatToken = (adapter, formatToken) => {
3
+ const config = adapter.formatTokenMap[formatToken];
4
4
  if (config == null) {
5
5
  throw new Error([`MUI X: The token "${formatToken}" is not supported by the Date and Time Pickers.`, 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
6
6
  }
@@ -17,32 +17,32 @@ export const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
17
17
  maxLength: config.maxLength
18
18
  };
19
19
  };
20
- export const getDaysInWeekStr = (utils, format) => {
20
+ export const getDaysInWeekStr = (adapter, format) => {
21
21
  const elements = [];
22
- const now = utils.date(undefined, 'default');
23
- const startDate = utils.startOfWeek(now);
24
- const endDate = utils.endOfWeek(now);
22
+ const now = adapter.date(undefined, 'default');
23
+ const startDate = adapter.startOfWeek(now);
24
+ const endDate = adapter.endOfWeek(now);
25
25
  let current = startDate;
26
- while (utils.isBefore(current, endDate)) {
26
+ while (adapter.isBefore(current, endDate)) {
27
27
  elements.push(current);
28
- current = utils.addDays(current, 1);
28
+ current = adapter.addDays(current, 1);
29
29
  }
30
- return elements.map(weekDay => utils.formatByString(weekDay, format));
30
+ return elements.map(weekDay => adapter.formatByString(weekDay, format));
31
31
  };
32
- export const getLetterEditingOptions = (utils, timezone, sectionType, format) => {
32
+ export const getLetterEditingOptions = (adapter, timezone, sectionType, format) => {
33
33
  switch (sectionType) {
34
34
  case 'month':
35
35
  {
36
- return getMonthsInYear(utils, utils.date(undefined, timezone)).map(month => utils.formatByString(month, format));
36
+ return getMonthsInYear(adapter, adapter.date(undefined, timezone)).map(month => adapter.formatByString(month, format));
37
37
  }
38
38
  case 'weekDay':
39
39
  {
40
- return getDaysInWeekStr(utils, format);
40
+ return getDaysInWeekStr(adapter, format);
41
41
  }
42
42
  case 'meridiem':
43
43
  {
44
- const now = utils.date(undefined, timezone);
45
- return [utils.startOfDay(now), utils.endOfDay(now)].map(date => utils.formatByString(date, format));
44
+ const now = adapter.date(undefined, timezone);
45
+ return [adapter.startOfDay(now), adapter.endOfDay(now)].map(date => adapter.formatByString(date, format));
46
46
  }
47
47
  default:
48
48
  {
@@ -55,15 +55,15 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
55
55
  // If some adapter does not respect this convention, then we will need to hardcode the format on each adapter.
56
56
  export const FORMAT_SECONDS_NO_LEADING_ZEROS = 's';
57
57
  const NON_LOCALIZED_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
58
- export const getLocalizedDigits = utils => {
59
- const today = utils.date(undefined);
60
- const formattedZero = utils.formatByString(utils.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
58
+ export const getLocalizedDigits = adapter => {
59
+ const today = adapter.date(undefined);
60
+ const formattedZero = adapter.formatByString(adapter.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
61
61
  if (formattedZero === '0') {
62
62
  return NON_LOCALIZED_DIGITS;
63
63
  }
64
64
  return Array.from({
65
65
  length: 10
66
- }).map((_, index) => utils.formatByString(utils.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS));
66
+ }).map((_, index) => adapter.formatByString(adapter.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS));
67
67
  };
68
68
  export const removeLocalizedDigits = (valueStr, localizedDigits) => {
69
69
  if (localizedDigits[0] === '0') {
@@ -102,7 +102,7 @@ export const cleanLeadingZeros = (valueStr, size) => {
102
102
  // Remove the leading zeros and then add back as many as needed.
103
103
  return Number(valueStr).toString().padStart(size, '0');
104
104
  };
105
- export const cleanDigitSectionValue = (utils, value, sectionBoundaries, localizedDigits, section) => {
105
+ export const cleanDigitSectionValue = (adapter, value, sectionBoundaries, localizedDigits, section) => {
106
106
  if (process.env.NODE_ENV !== 'production') {
107
107
  if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
108
108
  throw new Error([`MUI X: The token "${section.format}" is a digit format with letter in it.'
@@ -110,8 +110,8 @@ export const cleanDigitSectionValue = (utils, value, sectionBoundaries, localize
110
110
  }
111
111
  }
112
112
  if (section.type === 'day' && section.contentType === 'digit-with-letter') {
113
- const date = utils.setDate(sectionBoundaries.longestMonth, value);
114
- return utils.formatByString(date, section.format);
113
+ const date = adapter.setDate(sectionBoundaries.longestMonth, value);
114
+ return adapter.formatByString(date, section.format);
115
115
  }
116
116
 
117
117
  // queryValue without leading `0` (`01` => `1`)
@@ -142,53 +142,53 @@ export const getSectionVisibleValue = (section, target, localizedDigits) => {
142
142
  }
143
143
  return value;
144
144
  };
145
- export const changeSectionValueFormat = (utils, valueStr, currentFormat, newFormat) => {
145
+ export const changeSectionValueFormat = (adapter, valueStr, currentFormat, newFormat) => {
146
146
  if (process.env.NODE_ENV !== 'production') {
147
- if (getDateSectionConfigFromFormatToken(utils, currentFormat).type === 'weekDay') {
147
+ if (getDateSectionConfigFromFormatToken(adapter, currentFormat).type === 'weekDay') {
148
148
  throw new Error("changeSectionValueFormat doesn't support week day formats");
149
149
  }
150
150
  }
151
- return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
151
+ return adapter.formatByString(adapter.parse(valueStr, currentFormat), newFormat);
152
152
  };
153
- const isFourDigitYearFormat = (utils, format) => utils.formatByString(utils.date(undefined, 'system'), format).length === 4;
154
- export const doesSectionFormatHaveLeadingZeros = (utils, contentType, sectionType, format) => {
153
+ const isFourDigitYearFormat = (adapter, format) => adapter.formatByString(adapter.date(undefined, 'system'), format).length === 4;
154
+ export const doesSectionFormatHaveLeadingZeros = (adapter, contentType, sectionType, format) => {
155
155
  if (contentType !== 'digit') {
156
156
  return false;
157
157
  }
158
- const now = utils.date(undefined, 'default');
158
+ const now = adapter.date(undefined, 'default');
159
159
  switch (sectionType) {
160
- // We can't use `changeSectionValueFormat`, because `utils.parse('1', 'YYYY')` returns `1971` instead of `1`.
160
+ // We can't use `changeSectionValueFormat`, because `adapter.parse('1', 'YYYY')` returns `1971` instead of `1`.
161
161
  case 'year':
162
162
  {
163
163
  // Remove once https://github.com/iamkun/dayjs/pull/2847 is merged and bump dayjs version
164
- if (utils.lib === 'dayjs' && format === 'YY') {
164
+ if (adapter.lib === 'dayjs' && format === 'YY') {
165
165
  return true;
166
166
  }
167
- return utils.formatByString(utils.setYear(now, 1), format).startsWith('0');
167
+ return adapter.formatByString(adapter.setYear(now, 1), format).startsWith('0');
168
168
  }
169
169
  case 'month':
170
170
  {
171
- return utils.formatByString(utils.startOfYear(now), format).length > 1;
171
+ return adapter.formatByString(adapter.startOfYear(now), format).length > 1;
172
172
  }
173
173
  case 'day':
174
174
  {
175
- return utils.formatByString(utils.startOfMonth(now), format).length > 1;
175
+ return adapter.formatByString(adapter.startOfMonth(now), format).length > 1;
176
176
  }
177
177
  case 'weekDay':
178
178
  {
179
- return utils.formatByString(utils.startOfWeek(now), format).length > 1;
179
+ return adapter.formatByString(adapter.startOfWeek(now), format).length > 1;
180
180
  }
181
181
  case 'hours':
182
182
  {
183
- return utils.formatByString(utils.setHours(now, 1), format).length > 1;
183
+ return adapter.formatByString(adapter.setHours(now, 1), format).length > 1;
184
184
  }
185
185
  case 'minutes':
186
186
  {
187
- return utils.formatByString(utils.setMinutes(now, 1), format).length > 1;
187
+ return adapter.formatByString(adapter.setMinutes(now, 1), format).length > 1;
188
188
  }
189
189
  case 'seconds':
190
190
  {
191
- return utils.formatByString(utils.setSeconds(now, 1), format).length > 1;
191
+ return adapter.formatByString(adapter.setSeconds(now, 1), format).length > 1;
192
192
  }
193
193
  default:
194
194
  {
@@ -201,7 +201,7 @@ export const doesSectionFormatHaveLeadingZeros = (utils, contentType, sectionTyp
201
201
  * Some date libraries like `dayjs` don't support parsing from date with escaped characters.
202
202
  * To make sure that the parsing works, we are building a format and a date without any separator.
203
203
  */
204
- export const getDateFromDateSections = (utils, sections, localizedDigits) => {
204
+ export const getDateFromDateSections = (adapter, sections, localizedDigits) => {
205
205
  // If we have both a day and a weekDay section,
206
206
  // Then we skip the weekDay in the parsing because libraries like dayjs can't parse complicated formats containing a weekDay.
207
207
  // dayjs(dayjs().format('dddd MMMM D YYYY'), 'dddd MMMM D YYYY')) // returns `Invalid Date` even if the format is valid.
@@ -218,7 +218,7 @@ export const getDateFromDateSections = (utils, sections, localizedDigits) => {
218
218
  }
219
219
  const formatWithoutSeparator = sectionFormats.join(' ');
220
220
  const dateWithoutSeparatorStr = sectionValues.join(' ');
221
- return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
221
+ return adapter.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
222
222
  };
223
223
  export const createDateStrForV7HiddenInputFromSections = sections => sections.map(section => {
224
224
  return `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator}`;
@@ -240,15 +240,15 @@ export const createDateStrForV6InputFromSections = (sections, localizedDigits, i
240
240
  // wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
241
241
  return `\u2066${dateStr}\u2069`;
242
242
  };
243
- export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
244
- const today = utils.date(undefined, timezone);
245
- const endOfYear = utils.endOfYear(today);
246
- const endOfDay = utils.endOfDay(today);
243
+ export const getSectionsBoundaries = (adapter, localizedDigits, timezone) => {
244
+ const today = adapter.date(undefined, timezone);
245
+ const endOfYear = adapter.endOfYear(today);
246
+ const endOfDay = adapter.endOfDay(today);
247
247
  const {
248
248
  maxDaysInMonth,
249
249
  longestMonth
250
- } = getMonthsInYear(utils, today).reduce((acc, month) => {
251
- const daysInMonth = utils.getDaysInMonth(month);
250
+ } = getMonthsInYear(adapter, today).reduce((acc, month) => {
251
+ const daysInMonth = adapter.getDaysInMonth(month);
252
252
  if (daysInMonth > acc.maxDaysInMonth) {
253
253
  return {
254
254
  maxDaysInMonth: daysInMonth,
@@ -265,18 +265,18 @@ export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
265
265
  format
266
266
  }) => ({
267
267
  minimum: 0,
268
- maximum: isFourDigitYearFormat(utils, format) ? 9999 : 99
268
+ maximum: isFourDigitYearFormat(adapter, format) ? 9999 : 99
269
269
  }),
270
270
  month: () => ({
271
271
  minimum: 1,
272
272
  // Assumption: All years have the same amount of months
273
- maximum: utils.getMonth(endOfYear) + 1
273
+ maximum: adapter.getMonth(endOfYear) + 1
274
274
  }),
275
275
  day: ({
276
276
  currentDate
277
277
  }) => ({
278
278
  minimum: 1,
279
- maximum: utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth,
279
+ maximum: adapter.isValid(currentDate) ? adapter.getDaysInMonth(currentDate) : maxDaysInMonth,
280
280
  longestMonth: longestMonth
281
281
  }),
282
282
  weekDay: ({
@@ -284,7 +284,7 @@ export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
284
284
  contentType
285
285
  }) => {
286
286
  if (contentType === 'digit') {
287
- const daysInWeek = getDaysInWeekStr(utils, format).map(Number);
287
+ const daysInWeek = getDaysInWeekStr(adapter, format).map(Number);
288
288
  return {
289
289
  minimum: Math.min(...daysInWeek),
290
290
  maximum: Math.max(...daysInWeek)
@@ -298,12 +298,12 @@ export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
298
298
  hours: ({
299
299
  format
300
300
  }) => {
301
- const lastHourInDay = utils.getHours(endOfDay);
302
- const hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
301
+ const lastHourInDay = adapter.getHours(endOfDay);
302
+ const hasMeridiem = removeLocalizedDigits(adapter.formatByString(adapter.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
303
303
  if (hasMeridiem) {
304
304
  return {
305
305
  minimum: 1,
306
- maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format), localizedDigits))
306
+ maximum: Number(removeLocalizedDigits(adapter.formatByString(adapter.startOfDay(today), format), localizedDigits))
307
307
  };
308
308
  }
309
309
  return {
@@ -314,12 +314,12 @@ export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
314
314
  minutes: () => ({
315
315
  minimum: 0,
316
316
  // Assumption: All years have the same amount of minutes
317
- maximum: utils.getMinutes(endOfDay)
317
+ maximum: adapter.getMinutes(endOfDay)
318
318
  }),
319
319
  seconds: () => ({
320
320
  minimum: 0,
321
321
  // Assumption: All years have the same amount of seconds
322
- maximum: utils.getSeconds(endOfDay)
322
+ maximum: adapter.getSeconds(endOfDay)
323
323
  }),
324
324
  meridiem: () => ({
325
325
  minimum: 0,
@@ -350,55 +350,55 @@ export const validateSections = (sections, valueType) => {
350
350
  }
351
351
  }
352
352
  };
353
- const transferDateSectionValue = (utils, section, dateToTransferFrom, dateToTransferTo) => {
353
+ const transferDateSectionValue = (adapter, section, dateToTransferFrom, dateToTransferTo) => {
354
354
  switch (section.type) {
355
355
  case 'year':
356
356
  {
357
- return utils.setYear(dateToTransferTo, utils.getYear(dateToTransferFrom));
357
+ return adapter.setYear(dateToTransferTo, adapter.getYear(dateToTransferFrom));
358
358
  }
359
359
  case 'month':
360
360
  {
361
- return utils.setMonth(dateToTransferTo, utils.getMonth(dateToTransferFrom));
361
+ return adapter.setMonth(dateToTransferTo, adapter.getMonth(dateToTransferFrom));
362
362
  }
363
363
  case 'weekDay':
364
364
  {
365
- let dayInWeekStrOfActiveDate = utils.formatByString(dateToTransferFrom, section.format);
365
+ let dayInWeekStrOfActiveDate = adapter.formatByString(dateToTransferFrom, section.format);
366
366
  if (section.hasLeadingZerosInInput) {
367
367
  dayInWeekStrOfActiveDate = cleanLeadingZeros(dayInWeekStrOfActiveDate, section.maxLength);
368
368
  }
369
- const formattedDaysInWeek = getDaysInWeekStr(utils, section.format);
369
+ const formattedDaysInWeek = getDaysInWeekStr(adapter, section.format);
370
370
  const dayInWeekOfActiveDate = formattedDaysInWeek.indexOf(dayInWeekStrOfActiveDate);
371
371
  const dayInWeekOfNewSectionValue = formattedDaysInWeek.indexOf(section.value);
372
372
  const diff = dayInWeekOfNewSectionValue - dayInWeekOfActiveDate;
373
- return utils.addDays(dateToTransferFrom, diff);
373
+ return adapter.addDays(dateToTransferFrom, diff);
374
374
  }
375
375
  case 'day':
376
376
  {
377
- return utils.setDate(dateToTransferTo, utils.getDate(dateToTransferFrom));
377
+ return adapter.setDate(dateToTransferTo, adapter.getDate(dateToTransferFrom));
378
378
  }
379
379
  case 'meridiem':
380
380
  {
381
- const isAM = utils.getHours(dateToTransferFrom) < 12;
382
- const mergedDateHours = utils.getHours(dateToTransferTo);
381
+ const isAM = adapter.getHours(dateToTransferFrom) < 12;
382
+ const mergedDateHours = adapter.getHours(dateToTransferTo);
383
383
  if (isAM && mergedDateHours >= 12) {
384
- return utils.addHours(dateToTransferTo, -12);
384
+ return adapter.addHours(dateToTransferTo, -12);
385
385
  }
386
386
  if (!isAM && mergedDateHours < 12) {
387
- return utils.addHours(dateToTransferTo, 12);
387
+ return adapter.addHours(dateToTransferTo, 12);
388
388
  }
389
389
  return dateToTransferTo;
390
390
  }
391
391
  case 'hours':
392
392
  {
393
- return utils.setHours(dateToTransferTo, utils.getHours(dateToTransferFrom));
393
+ return adapter.setHours(dateToTransferTo, adapter.getHours(dateToTransferFrom));
394
394
  }
395
395
  case 'minutes':
396
396
  {
397
- return utils.setMinutes(dateToTransferTo, utils.getMinutes(dateToTransferFrom));
397
+ return adapter.setMinutes(dateToTransferTo, adapter.getMinutes(dateToTransferFrom));
398
398
  }
399
399
  case 'seconds':
400
400
  {
401
- return utils.setSeconds(dateToTransferTo, utils.getSeconds(dateToTransferFrom));
401
+ return adapter.setSeconds(dateToTransferTo, adapter.getSeconds(dateToTransferFrom));
402
402
  }
403
403
  default:
404
404
  {
@@ -417,11 +417,11 @@ const reliableSectionModificationOrder = {
417
417
  meridiem: 8,
418
418
  empty: 9
419
419
  };
420
- export const mergeDateIntoReferenceDate = (utils, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
420
+ export const mergeDateIntoReferenceDate = (adapter, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
421
421
  // cloning sections before sort to avoid mutating it
422
422
  [...sections].sort((a, b) => reliableSectionModificationOrder[a.type] - reliableSectionModificationOrder[b.type]).reduce((mergedDate, section) => {
423
423
  if (!shouldLimitToEditedSections || section.modified) {
424
- return transferDateSectionValue(utils, section, dateToTransferFrom, mergedDate);
424
+ return transferDateSectionValue(adapter, section, dateToTransferFrom, mergedDate);
425
425
  }
426
426
  return mergedDate;
427
427
  }, referenceDate);