Repository navigation
Fix repeated day in calendar - #3302
Conversation
Root cause: we were creating a `Date` that did not exist in my timezone (Santiago, Chile) because of DST. The JS engine decided to pick the previous day, so I ended up with two times 5 September. Fix: introduce a `DateOnly` object that internally uses UTC (to prevent DST issues). Other parts of the system still use `Date`, which probably should be refactored to use `DateOnly` as well (maybe in an upcoming PR?). In the meantime, we provide a function to export a `DateOnly` as a `Date`, using noon as the time instead of midnight (because there are no DST changes at noon AFAIK). We tested this manually (see the attached screenshots), but didn't find a suitable place for automated tests.
|
/claude review |
Claude reviewNo issues found. Checked: |
Root cause: we were creating a `Date` that did not exist in my timezone (Santiago, Chile) because of DST. The JS engine decided to pick the previous day, so I ended up with two times 5 September. Fix: introduce a `DateOnly` object that internally uses UTC (to prevent DST issues). Other parts of the system still use `Date`, which probably should be refactored to use `DateOnly` as well (maybe in an upcoming PR?). In the meantime, we provide a function to export a `DateOnly` as a `Date`, using noon as the time instead of midnight (because there are no DST changes at noon AFAIK). We tested this manually (see the attached screenshots), but didn't find a suitable place for automated tests. port 1.6 (cherry picked from commit e479332)
Description
Fixes an issue with the calendar (5 September was repeated, as shown in the screenshots below).
Root cause: we were creating a
Datethat did not exist in my timezone (Santiago, Chile) because of DST. The JS engine decided to pick the previous day.Fix: introduce a
DateOnlyobject that internally uses UTC (to prevent DST issues). Other parts of the system still useDate, which probably should be refactored to useDateOnlyas well (maybe in an upcoming PR?). In the meantime, we provide a function to export aDateOnlyas aDate, using noon as the time instead of midnight (because there are no DST changes at noon AFAIK).We tested this manually, but didn't find a suitable place for automated tests.
Type of change
Related issues
None
Screenshots / video
Before (note that 5 september is repeated):
After:
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warningsNote: there was a swath of QML lint errors, but they seem unrelated to my change