mui-x
mui-x copied to clipboard
[pickers] DateCalendar broken, even on MUI website
Steps to reproduce
Link to live example: (required)
I'm suddenly having some problems with the DateCalendar component. Some of them are present on the documentation site. The two that you can see in the docs are:
- Whatever day you select, the previous day gets selected too
- The bottom row of days is not aligned with the rest of the calendar
I was about go live with this calendar, any idea what's going on?
Current behavior
No response
Expected behavior
No response
Context
No response
Your environment
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
Search keywords: calendar
Hey @romidgomez, could you clarify your setup?
- What props are you passing to the
DateCalendar? - Do you use any specific timezone or UTC?
- Which timezone are you on?
- Which adapter are you using?
It would be great to have a StackBlitz or other live code example with a minimal setup with which you are experiencing problems. 🙏
You can see a live example here, on "Basic usage": https://mui.com/x/react-date-pickers/date-calendar/#basic-usage
You can also check the setup by clicking on "expand code", it looks like this:
import * as React from 'react';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateCalendar } from '@mui/x-date-pickers/DateCalendar';
export default function BasicDateCalendar() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateCalendar />
</LocalizationProvider>
);
}
Whatever day you select, the previous day gets selected too
I could not reproduce this behavior on the demo you linked. Could you please record a short video to make sure we are checking the right place / behaviors?
Am I going crazy and this is expected behavior? https://www.loom.com/share/c4b278022bda4d39941ceeb4446ed491
OK this is clearly not the expected behavior :laughing: Could you please tell me your current timezone? It's the only thing I see that could differ between your env and ours.
@flaviendelangle It will probably be a duplicate of https://github.com/mui/mui-x/issues/10804 Not direct, but because everyone is on their own timezone, sometimes you might not need explicit timezone changes to see the effect. I can take a look at it as solving it is already long overdue. 🙈
OK this is clearly not the expected behavior 😆 Could you please tell me your current timezone? It's the only thing I see that could differ between your env and ours.
I'm in CET! Fyi, this started happening yesterday, maybe before yesterday.
EDIT: I just realized I started using an extension to change my browser's timezone, so it might be a me problem. I disabled it and things are working again, but just in case, the time zone I was on was Pacific/Fiji, UTC+12.
We already had similar issue with this kind of extensions in the past I think the problem is that they don't change the timezone directly (they can't), they hack into the date management to simulate the timezone change, and it does not work well with how we manage timezones.
Not sure if we could support them correctly, or if we could detect them and add a warning .
We agreed to spend some time exploring if we can detect usage of extension and warn user about potential inconsistent behavior in such case.