Skip to content

Commit 0c6aa25

Browse files
[pickers] Remove NonEmptyDateRange type (#16035)
1 parent 2cc9bc8 commit 0c6aa25

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

docs/data/migration/migration-pickers-v7/migration-pickers-v7.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,25 @@ The `TSection` generic of the `FieldRef` type has been replaced with the `TValue
802802
The following types are no longer exported by `@mui/x-date-pickers` and/or `@mui/x-date-pickers-pro`.
803803
If you were using them, you need to replace them with the following code:
804804

805+
- `NonEmptyDateRange`
806+
807+
```ts
808+
// When using AdapterDayjs
809+
import { Dayjs } from 'dayjs';
810+
type NonEmptyDateRange = [Dayjs, Dayjs];
811+
812+
// When using AdapterLuxon
813+
import { DateTime } from 'luxon';
814+
type NonEmptyDateRange = [DateTime, DateTime];
815+
816+
// When using AdapterMoment, AdapterMomentJalaali or AdapterMomentHijri
817+
import { Moment } from 'moment';
818+
type NonEmptyDateRange = [Moment, Moment];
819+
820+
// When using AdapterDateFns, AdapterDateFnsV3, AdapterDateFnsJalali or AdapterDateFnsJalaliV3
821+
type NonEmptyDateRange = [Date, Date];
822+
```
823+
805824
- `UseDateFieldComponentProps`
806825

807826
```ts

packages/x-date-pickers-pro/src/models/range.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@ import { PickerValidDate } from '@mui/x-date-pickers/models';
22

33
// Should not be used in our packages, instead use `PickerRangeValue` from the community package.
44
export type DateRange<TDate extends PickerValidDate> = [TDate | null, TDate | null];
5-
6-
// TODO v8: Remove
7-
export type NonEmptyDateRange = [PickerValidDate, PickerValidDate];

packages/x-date-pickers/src/internals/hooks/useField/useField.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ export const mergeDateIntoReferenceDate = (
736736

737737
export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
738738

739-
// TODO v8: Remove if we drop the v6 TextField approach.
739+
// TODO v9: Remove
740740
export const getSectionOrder = (
741741
sections: FieldSection[],
742742
shouldApplyRTL: boolean,

scripts/x-date-pickers-pro.exports.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@
243243
{ "name": "MultiSectionDigitalClockSectionClassKey", "kind": "TypeAlias" },
244244
{ "name": "MultiSectionDigitalClockSlotProps", "kind": "Interface" },
245245
{ "name": "MultiSectionDigitalClockSlots", "kind": "Interface" },
246-
{ "name": "NonEmptyDateRange", "kind": "TypeAlias" },
247246
{ "name": "OnErrorProps", "kind": "Interface" },
248247
{ "name": "PickerChangeHandlerContext", "kind": "Interface" },
249248
{ "name": "PickerChangeImportance", "kind": "TypeAlias" },

0 commit comments

Comments
 (0)