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(core): using correct timezone when parsing dates #1355

Merged
merged 6 commits into from
Jul 14, 2022
Merged

Conversation

TheSlimvReal
Copy link
Collaborator

@TheSlimvReal TheSlimvReal commented Jul 10, 2022

To test the issue on the current version:

  1. Set your computers time to a timezone before UTC, e.g. UTC-0600
  2. Create a new ChildSchoolRelation (child -> education)
  3. See the start date and the end date are one day before what you selected (even though the right time is saved to the database)

This is because new Date("2022-01-01") is interpreted as UTC time. Converting this to UTC-0600 results in 6pm the day before (2021-12-31).
The very simple fix to this is to instead use a different date constructor: new Date(2022, 0, 1) is interpreted as first of January 2022 in the local time.

Visible/Frontend Changes

--

Architectural/Backend Changes

  • datatypes date-only and month are interpreted with the local timezone

@github-actions
Copy link

Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sonarcloud
Copy link

sonarcloud bot commented Jul 14, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sleidig sleidig merged commit 4d6e403 into master Jul 14, 2022
@sleidig sleidig deleted the fix-date-bug branch July 14, 2022 14:40
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.8.2-master.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.8.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants