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

[@mantine/dates] DateTimePicker: prevent converting value to DateProvider twice #7400

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

mrbnclt
Copy link
Contributor

@mrbnclt mrbnclt commented Jan 22, 2025

DateTimePicker uses useUncontrolledDates hook which is already using the context from the DateProvider to convert the default value into the DateProviders timezone.

In the DateTimePicker we shouldn't do another .tz() that will convert the date & time into the DateProvider's timezone, the result will be incorrect if that's the implementation.

Fix was to pass true to the .tz()'s second parameter (keepLocalTime), which doesn't convert the value again to the DateProvider's timezone.

Before

before

After

after

Closes #7388

@rtivital
Copy link
Member

Please fix errors in tests

@mrbnclt mrbnclt force-pushed the fix/date-time-picker-value branch from afa777f to cb420bb Compare January 22, 2025 18:54
@mrbnclt
Copy link
Contributor Author

mrbnclt commented Jan 23, 2025

Hi @rtivital test are now passing, for your review please 🙇🏻

@rtivital rtivital merged commit f7347e9 into mantinedev:master Jan 26, 2025
1 check passed
@rtivital
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datetime input field shows incorrect time while the dropdown/modal is accurate
2 participants