-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Pickers] Rename date
view
to day
#25685
Conversation
090ccdb
to
3e8de72
Compare
type TabValue = 'date' | 'time'; | ||
|
||
const viewToTab = (openView: DateTimePickerView): TabValue => { | ||
// TODO: what happens if `openView` is `month`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refactoring revealed accidental coupling with the DateTimePickerTabs they handle clock and calendar view switch not the DateTimePickerView switch. Will revisit this when renaming DayPicker
to CalendarPicker
where TabValue
might become 'clock' | 'calendar'
.
@@ -28,7 +28,7 @@ interface DesktopDateRangeCalendarProps<TDate> | |||
changeMonth: (date: TDate) => void; | |||
} | |||
|
|||
const onlyDateView = ['date'] as ['date']; | |||
const onlyDayView = ['day'] as ['day']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
const onlyDayView = ['day'] as ['day']; | |
const onlyDayView = ['day'] as const; |
but most of our typings conflict with readonly arrays. We should change all T[]
props to readonly T[]
props at some point to ensure compat with as const
casts i.e. apply #24639 consistently.
3e8de72
to
5fa9a40
Compare
5fa9a40
to
4c647f6
Compare
BREAKING CHANGE
Part of https://github.com/mui-org/material-ui/issues/25481
Based on #25679 (diff).
Right now we have the
DatePicker
which has theyear
,month
anddate
view
. That's a bit confusing sincedate
is already part of the component name whendate
refers to a particular day.This PR creates another conflict with the
DayPicker
component which doesn't actually pick a day but a date. So we're going to renameDayPicker
toCalendarPicker
to completely entangle this confusion. Will add this in another PR though for proper changelog attention.