Skip to content

fix: keep the calendar day view working when midnight is skipped by DST - #150

Merged
jerelvelarde merged 3 commits into
CopilotKit:mainfrom
Mrdifferent2022:fix/calendar-dst-day-start
Oct 6, 2026
Merged

jerelvelarde merged 3 commits into
CopilotKit:mainfrom
Mrdifferent2022:fix/calendar-dst-day-start

Conversation

@Mrdifferent2022

Copy link
Copy Markdown
Contributor

Problem

The calendar events query built its day range with zonedInstant(date, "00:00", zone), which deliberately throws for nonexistent local times. On days when a zone springs forward at midnight (e.g. America/Santiago goes 00:00→01:00 on 2026-09-06), the promise rejected, the effect showed the "This time does not exist" error, and the user saw zero events for that day (in 30-day mode the whole query failed).

A day boundary is a range-computation detail, not a user-entered appointment time, so rejecting it serves no purpose.

Fix

Add startOfZonedDay in date-time.ts: resolve 00:00, and when a DST gap removes midnight, clamp to the first existing local time that day. The calendar query uses it for both range ends; event creation still uses zonedInstant and keeps rejecting gap times.

Verification

  • New tests in apps/mobile/test/date-time.test.ts: the Santiago spring-forward day clamps to 01:00 local (04:00Z), ordinary days still start at midnight.
  • pnpm --dir apps/mobile typecheck passes and the mobile unit tests pass.
  • Untested path (stated per CONTRIBUTING): rendered CalendarScreen behavior on a DST day; verified at the startOfZonedDay level instead.

Co-authored-by: Claude noreply@anthropic.com

Mrdifferent2022 and others added 2 commits October 6, 2026 14:55
The events query built its day range with zonedInstant(date, '00:00'),
which deliberately throws for nonexistent local times. On days when a
zone springs forward at midnight (e.g. America/Santiago 00:00→01:00),
the whole day view failed with 'This time does not exist' and showed no
events. Day boundaries are a range-computation detail, not an entered
appointment time, so startOfZonedDay clamps to the first existing local
time instead of throwing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jerelvelarde
jerelvelarde previously approved these changes Oct 6, 2026

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Value: day-range queries work when DST skips midnight, while appointment entry still rejects nonexistent times. Six date-time tests passed. Template: verification and rendered-screen limitation stated; UI evidence would complete the description. Updated-main diff reviewed; no actionable security finding. Merge after required CI.

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed the formatting-only revision. Six date-time tests and Biome on all changed files pass. Previous value/template/security assessment holds. Merge after all required CI checks pass.

@jerelvelarde
jerelvelarde merged commit f760f71 into CopilotKit:main Oct 6, 2026
7 checks passed
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