mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[pickers] DateCalendar broken, even on MUI website

Open romidgomez opened this issue 1 year ago • 8 comments

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:

  1. Whatever day you select, the previous day gets selected too
  2. 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

romidgomez avatar Mar 21 '24 15:03 romidgomez

Hey @romidgomez, could you clarify your setup?

  1. What props are you passing to the DateCalendar?
  2. Do you use any specific timezone or UTC?
  3. Which timezone are you on?
  4. 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. 🙏

LukasTy avatar Mar 22 '24 07:03 LukasTy

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> ); }

romidgomez avatar Mar 22 '24 09:03 romidgomez

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?

flaviendelangle avatar Mar 22 '24 12:03 flaviendelangle

Am I going crazy and this is expected behavior? https://www.loom.com/share/c4b278022bda4d39941ceeb4446ed491

romidgomez avatar Mar 22 '24 12:03 romidgomez

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 avatar Mar 22 '24 12:03 flaviendelangle

@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. 🙈

LukasTy avatar Mar 22 '24 12:03 LukasTy

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.

romidgomez avatar Mar 22 '24 15:03 romidgomez

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 .

flaviendelangle avatar Mar 25 '24 07:03 flaviendelangle

We agreed to spend some time exploring if we can detect usage of extension and warn user about potential inconsistent behavior in such case.

LukasTy avatar Feb 18 '25 09:02 LukasTy