Skip to content

Fix repeated day in calendar - #3302

Merged
bbedward merged 1 commit into
duxlabs-dev:masterfrom
aochagavia:fix-calendar-and-dst
Sep 4, 2026
Merged

bbedward merged 1 commit into
duxlabs-dev:masterfrom
aochagavia:fix-calendar-and-dst

Conversation

@aochagavia

Copy link
Copy Markdown
Contributor

Description

Fixes an issue with the calendar (5 September was repeated, as shown in the screenshots below).

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.

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, but didn't find a suitable place for automated tests.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

None

Screenshots / video

Before (note that 5 september is repeated):

before

After:

after

Checklist

Note: there was a swath of QML lint errors, but they seem unrelated to my change

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.
@bbedward

bbedward commented Sep 4, 2026

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found.

Checked: DateOnly arithmetic (addDays/addMonths/lastOfMonth/daysUntil are UTC-exact, equals guards null); ISO and US branches of getWeekNumber produce the same numbers as the old mutating version; firstDay/dayDate type change to var still notifies since each op returns a new object; every toDate() consumer (CalendarService.getEventsForDate/hasEventsForDate, loadEvents → dank/khal backends, addTaskForDate, reorderTasksForDate, CalendarEventEditor._allDayIso/_isoFromDateTime) reads local calendar fields, so local-noon is safe; relative .js import path and namespace-only-functions export style match existing files in quickshell/Common/; no external callers of the changed startOfWeek/endOfWeek/getWeekNumber signatures; isToday now tracks systemClock.date (hourly) instead of a never-updating new Date(). No new user-facing strings, no translation catalog edits, no Go changes. Model: claude-opus-5.

@bbedward
bbedward merged commit e479332 into duxlabs-dev:master Sep 4, 2026
1 check passed
dank-shell-app Bot pushed a commit that referenced this pull request Sep 4, 2026
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)
@aochagavia
aochagavia deleted the fix-calendar-and-dst branch September 5, 2026 00:15
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.

2 participants