[pickers] Replace the TDate
generic with PickerValidDate
in every type / interface
#14796
Labels
breaking change
component: pickers
This is the name of the generic UI component, not the React module!
typescript
Part of #13188
Small history
When we migrated the project from
@mui/lab
, after some cleaning we ended up with two generics:TInputDate
: the format supported byprops.value
which was the format parseable by the lib (usually something likeDate | Dayjs | string | undefined
)TDate
: the format of the date library (something likeDayjs
)See [pickers] Rework TDate, TInputDate, TValue and TInputValue generics #4617 for the full context
In version 6.0.0, we dropped the support for unparsed dates
People now have to pass
value={dayjs('2022-04-17')}
, formats likevalue="2022-04-17"
no longer work.See [pickers] Do not support unparsed date formats anymore #6170 for the full context
In version 7.0.0, we created a new type
PickerValidDate
that each adapter enriches with its date format.The interfaces in the application can now limit the valid values of
TDate
to beTDate extends PickerValidDate
.So the typing now looks something like this:
Proposal
In a real application you have only one adapter so only one value added to
PickerValidDate
, which means we can remove theTDate
generic and have the following:Search keywords:
The text was updated successfully, but these errors were encountered: