Skip to content

Commit

Permalink
comment added
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharyar-shamshi committed Mar 2, 2024
1 parent dca0d17 commit 6f71e8e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/x-date-pickers/src/DateCalendar/DayCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,12 @@ export function DayCalendar<TDate extends PickerValidDate>(inProps: DayCalendarP
const weeksToDisplay = React.useMemo(() => {
let currentMonthWithTimezone = utils.setTimezone(currentMonth, timezone);

/**
* This addresses a potential issue that arises when switching timezones
* changes the month. The calendar will renders days of the month currentmonth - 1,
* but will only consider the days of currentMonth as the current ones.
* @link https://github.com/mui/mui-x/issues/10804
*/
if (utils.getMonth(currentMonth) !== utils.getMonth(currentMonthWithTimezone)) {
currentMonthWithTimezone = utils.setMonthYearDate(
currentMonthWithTimezone,
Expand Down

0 comments on commit 6f71e8e

Please sign in to comment.