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

Fix DateInput ignores the timezone when given #10311

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

fzaninotto
Copy link
Member

Problem

The changes introduced in #10299 leads to a regression when the field value is an ISO string or date.

The idea of that change was that if the value contains a date, react-admin should always display that date.

This is often not what users want, because a date entered in a US browser than stored in GMT then displayed again will have shifted.

Besides, this is not required to fix #10197. The fix in #10299 is the removal of the call to parse in onChange (in fact, parse used to be called twice).

Solution

Do not strip the timezone data, whether the field value is a string or a date.

## Problem

The changes introduced in #10299 leads to a regression when the field value is an ISO string or date.

The idea of that change was that if the value contains a date, react-admin should always display that date.

This is often not what users want, because a date entered in a US browser than stored in GMT then displayed again will have shifted.

Besides, this is not required to fix #10197. The fix in #10299 is the removal of the call to `parse` in `onChange` (in fact, `parse` used to be called twice).

## Solution

Do not strip the timezone data, whether the field value is a string or a date.
@slax57 slax57 added this to the 5.3.2 milestone Oct 28, 2024
@slax57 slax57 merged commit 60bae65 into master Oct 28, 2024
15 checks passed
@slax57 slax57 deleted the fix-dateinput-shows-wrong-timezone branch October 28, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DateInput decrease the day by 1 when you change its value and trigger a form validation function
2 participants