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] Fix AdapterDayjs timezone behavior #13362

Merged
merged 4 commits into from
Jun 4, 2024

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 bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! needs cherry-pick The PR should be cherry-picked to master after merge 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! needs cherry-pick The PR should be cherry-picked to master after merge time-zone Issues about time zone management
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