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

Angular date picker: selected date is off by one day #2033

Closed
TheMicDiet opened this issue Oct 9, 2022 · 2 comments
Closed

Angular date picker: selected date is off by one day #2033

TheMicDiet opened this issue Oct 9, 2022 · 2 comments
Assignees
Milestone

Comments

@TheMicDiet
Copy link
Contributor

Describe the bug

When selecting a date from the date picker the date form field value is set to one day before the selected date. For example, choosing 9.10.2022 from the picker will result in 8.10.2022 being displayed in the date form field.

Expected behavior

The correct date value should be set, i.e., the date set and displayed in the date form field should match the selected date from the picker.

Steps to reproduce the issue

  1. Open the date picker on a date field.
  2. Click on any day.
  3. See the value in the date field is off by one day compared to the day previously clicked on.

Screenshots

No response

In which browser are you experiencing the issue?

Google Chrome 106.0.5249.103

Framework

Angular

RendererSet

Material

Additional context

This issue occurs both in my own app and on the JSONForms Angular Material Playground (https://jsonforms-angular-seed.netlify.app/).

@sdirix
Copy link
Member

sdirix commented Oct 13, 2022

Possible cause: Maybe some time zone shenanigans are interfering here. For example it could be that we set the time to 00:00 of the selected day, but because of some automatic timezone consideration the day is then calculated to the day before.

@TheMicDiet
Copy link
Contributor Author

I think you’re right. If I change my time zone to UTC, the date is correct.

TheMicDiet added a commit to TheMicDiet/jsonforms that referenced this issue Oct 14, 2022
replace toISOString() with Angular date pipe to format dates according to the local time zone instead of utc
TheMicDiet added a commit to TheMicDiet/jsonforms that referenced this issue Oct 15, 2022
replace toISOString(), which formats dates based on the UTC time zone with Angular DatePipe, which works with local time zones
@sdirix sdirix linked a pull request Nov 29, 2022 that will close this issue
LukasBoll pushed a commit to LukasBoll/jsonforms that referenced this issue Feb 12, 2024
replace toISOString(), which formats dates based on the UTC time zone with Angular DatePipe, which works with local time zones
LukasBoll pushed a commit to LukasBoll/jsonforms that referenced this issue Mar 11, 2024
replace toISOString(), which formats dates based on the UTC time zone with Angular DatePipe, which works with local time zones
@sdirix sdirix closed this as completed in 424484d Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants