Skip to content

Conversation

@LukasTy
Copy link
Member

@LukasTy LukasTy commented Jun 4, 2024

Fixes #13290

The main problem was that in an environment, where utc and timezone plugins are enabled, but regular dayjs constructor is used, changing value could have resulted in timezone differences.

Steps to reproduce

  • Focus input
  • Press ArrowDown twice
  • Observe the thrown exception/error

Before

https://codesandbox.io/p/sandbox/adapterdayjs-daterangepicker-timezone-error-lqdjgx?file=%2Fsrc%2FApp.tsx

After

https://codesandbox.io/p/sandbox/adapterdayjs-daterangepicker-timezone-error-fixed-hcz288?file=%2Fsrc%2FApp.tsx

@LukasTy LukasTy added type: bug It doesn't behave as expected. scope: pickers Changes related to the date/time pickers. needs cherry-pick The PR should be cherry-picked to master after merge. feature: time-zone Issues about time zone management. labels Jun 4, 2024
@LukasTy LukasTy self-assigned this Jun 4, 2024
@mui-bot
Copy link

mui-bot commented Jun 4, 2024

Deploy preview: https://deploy-preview-13362--material-ui-x.netlify.app/

Updated pages:

Generated by 🚫 dangerJS against 1c5253d

@flaviendelangle
Copy link
Member

@LukasTy out of curiosity, what required a e2e test here rather than a unit test?

@LukasTy
Copy link
Member Author

LukasTy commented Jun 4, 2024

out of curiosity, what required a e2e test here rather than a unit test?

I failed to trigger this case in a unit test.
Besides, we use the UTC timezone in them, which might have been a secondary roadblock for using a unit test. 🙈

@flaviendelangle
Copy link
Member

OK 👌

Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Great fix!

@LukasTy LukasTy merged commit 13f286c into mui:master Jun 4, 2024
@LukasTy LukasTy deleted the fix-dayjs-timezone-behavior branch June 4, 2024 14:54
DungTiger pushed a commit to DungTiger/mui-x that referenced this pull request Jul 23, 2024
thomasmoon pushed a commit to thomasmoon/mui-x that referenced this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: time-zone Issues about time zone management. needs cherry-pick The PR should be cherry-picked to master after merge. scope: pickers Changes related to the date/time pickers. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pickers][DateRangePicker] timezones handled incorrectly with dayjs when timezone extensions are enabled

3 participants