mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.05k stars 1.25k forks source link

[pickers] Unable to set timezone in DatePicker #12195

Closed SatendraRaghav closed 6 months ago

SatendraRaghav commented 6 months ago

Steps to reproduce

Link to live example: (required)

Steps:

  1. Develop a date component with MUI X DatePicker in a form
  2. Call an api and send api formdata in api payload , Open payload in network tab , you can see previous date is coming in payload.

Current behavior

Previous date is coming in payload and also there is no props available to set timezone in DatePicker.

Expected behavior

Selected date should be come and there should be timezone props to change date according to timezone.

Context

No response

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: timezone,datepicker, UTC,

Search keywords:

michelengelen commented 6 months ago

Hey @SatendraRaghav,

Could you please provide a minimal reproduction test case with the latest version. This would help a lot 👷.

Also there is a timezone prop on the DatePicker (API docs).

It does indeed seem to be a bit off @LukasTy ... 🤔 Any idea where that would come from? Or is this expected behaviour?

LukasTy commented 6 months ago

@SatendraRaghav I've tried reproducing your case with having old data in the FormData, but to no avail. Could you please provide more details, as Michel mentioned?

shaharyar-shamshi commented 6 months ago

@LukasTy this seems indeed a bug but one major observation that I made is this happen when we switch to any American timezone. This works fine for switching from UTC to Asia/Calcutta. But when we switch from UTC to any American timezone this bug occur. Also Luxon give same issue.

shaharyar-shamshi commented 6 months ago

@LukasTy This seems to be duplicate of https://github.com/mui/mui-x/issues/10804.

If we plan to fix this can I pick this issue.

LukasTy commented 6 months ago

This seems to be duplicate of #10804.

Good observation. Maybe it is, we'd need more information from the issue author to confirm it. 👍

If we plan to fix this can I pick this issue.

@shaharyar-shamshi Oh yes, that was one of the more immediate things on the agenda. Timezone management issues could be non-trivial to solve and we need reliable tests to cover those problems. If you are up for the challenge - feel free to look into it. 😉

shaharyar-shamshi commented 6 months ago

This seems to be duplicate of #10804.

Good observation. Maybe it is, we'd need more information from the issue author to confirm it. 👍

If we plan to fix this can I pick this issue.

@shaharyar-shamshi Oh yes, that was one of the more immediate things on the agenda. Timezone management issues could be non-trivial to solve and we need reliable tests to cover those problems. If you are up for the challenge - feel free to look into it. 😉

Timezone 😭 I am up for the challenge but I might require some more context. let me explore this more

michelengelen commented 6 months ago

@shaharyar-shamshi let me know if you are still up for the challenge. If not we can just take it from here. Thanks for looking into it and don't hesitate to reach out for help! 💪🏼

shaharyar-shamshi commented 6 months ago

@shaharyar-shamshi let me know if you are still up for the challenge. If not we can just take it from here. Thanks for looking into it and don't hesitate to reach out for help! 💪🏼

yes I am up for this challenge I have just started looking into the code and understand how timezone is managed

github-actions[bot] commented 6 months ago

The issue has been inactive for 7 days and has been automatically closed.