Skip to content
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

Merged
merged 7 commits into from
Apr 13, 2021
Merged

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Apr 9, 2021

BREAKING CHANGE

  • [DatePicker] Improve the terminology of date vs. day
-<DatePicker openTo="date" views={['date', 'month']} />
+<DatePicker openTo="day" views={['day', 'month']} />

Part of https://github.com/mui-org/material-ui/issues/25481

Based on #25679 (diff).

Right now we have the DatePicker which has the year, month and date view. That's a bit confusing since date is already part of the component name when date 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 rename DayPicker to CalendarPicker to completely entangle this confusion. Will add this in another PR though for proper changelog attention.

@eps1lon eps1lon added breaking change component: pickers This is the name of the generic UI component, not the React module! labels Apr 9, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Apr 9, 2021

Details of bundle changes

Generated by 🚫 dangerJS against 4c647f6

type TabValue = 'date' | 'time';

const viewToTab = (openView: DateTimePickerView): TabValue => {
// TODO: what happens if `openView` is `month`?
Copy link
Member Author

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'];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be

Suggested change
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.

@eps1lon eps1lon marked this pull request as ready for review April 13, 2021 10:01
@eps1lon eps1lon merged commit cd8a42d into mui:next Apr 13, 2021
@eps1lon eps1lon deleted the feat/rename-date-view branch April 13, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants