mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.79k stars 1.9k forks source link

DateTimePicker's hidden value does not respect DatesProvider timezone #6828

Closed dylantf closed 1 month ago

dylantf commented 2 months ago

Dependencies check up

What version of @mantine/* packages do you have in package.json?

7.12.2

What package has an issue?

@mantine/dates

What framework do you use?

Remix

In which browsers you can reproduce the issue?

Chrome

Describe the bug

When setting a timezone through DatesProvider, it appears that the internal conversion is done correctly on the underlying Date object for the input's value. However, when inspecting the hidden input, there is a further conversion being done based on the browser's timezone, which results in the value being incorrect when submitting a plain HTML form.

Example:

If possible, include a link to a codesandbox with a minimal reproduction

No response

Possible fix

No response

Self-service

Kenzo-Wada commented 1 month ago

Can you provide a reproduction sandbox?

dylantf commented 1 month ago

Sure, here's a sandbox: https://codesandbox.io/p/sandbox/mantine-react-template-forked-pm3mxg

You may need to adjust the timezone based on where you are to see the problem.

Screenshot 2024-09-19 at 4 21 37 PM
mkf62 commented 1 month ago

I'm experiencing the same or similar issue trying to use UTC with the DatePickerInput component (I am located in eastern TZ). Codesandbox.

Screenshot 2024-09-23 at 8 28 15 PM