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

Local timezone affects selected time and modelValue when you use custom modelType #1095

Closed
mkeyy0 opened this issue Mar 12, 2025 · 1 comment

Comments

@mkeyy0
Copy link

mkeyy0 commented Mar 12, 2025

Describe the bug
When you set modelType with a custom format, the calculations start to include the local timezone. In my case, it set it as yyyy-MM-dd HH:mm. As a result, it makes time calculation wrong inside the input and time select when you set modelValue programmatically, but it also makes modelValue convertation wrong if you select time through the time picker.

I guess the issue is that you use the built-in date object that adds the local timezone when you call the parse method of the date-fns Link to the code line. It can be fixed using UTCDate from the @date-fns/utc package or in another way.

To Reproduce

  1. Visit reproduction link
  2. See the result
  3. You can also try to select a time through the date picker to see that modelValue has a wrong value.

Please note that to reproduce this bug, you should have the system timezone set as a value that doesn't have a zero UTC offset

Expected behavior
The local timezone shouldn't affect the parsing results of the model value and input when the timezone is set.

Specific to reproduction: The time in the initial state should be 00:00 as the Asia/Tokyo timezone have a UTC+09:00 offset. Then, if you select the 23:00 value in the time picker, the model value should have a time value that is equal to 13:00.

@mkeyy0 mkeyy0 added awaiting triage The issue is not reviewed by the maintainers bug Something isn't working labels Mar 12, 2025
@mkeyy0
Copy link
Author

mkeyy0 commented Mar 13, 2025

I'm sorry. It can be fixed by adding converModel: false to the timezone prop settings.

@mkeyy0 mkeyy0 closed this as completed Mar 13, 2025
@Jasenkoo Jasenkoo added no action and removed awaiting triage The issue is not reviewed by the maintainers bug Something isn't working labels Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants