fix(timezone): consolidate table wall-clock conversion - #7072
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
65d49f5 to
3a68f2d
Compare
Greptile SummaryThe PR consolidates table wall-clock conversion and timezone formatting into the shared timezone utility, while tightening date validation and expanding timezone-focused tests.
Confidence Score: 4/5The PR should not merge until ambiguous fall-back table inputs preserve the established later-occurrence behavior or the compatibility change is explicitly handled. The new shared resolver is reached by current date and TTL editor paths and changes a previously accepted ambiguous wall clock to an instant one hour earlier, which can alter persisted dates and expiration epochs. Files Needing Attention: apps/sim/lib/core/utils/timezone.ts, apps/sim/lib/table/dates.ts
|
| Filename | Overview |
|---|---|
| apps/sim/lib/core/utils/timezone.ts | Introduces the shared formatting and wall-clock resolver, but changes ambiguous fall-back inputs from the later occurrence to the earlier one. |
| apps/sim/lib/table/dates.ts | Centralizes timezone-aware normalization and adds strict calendar/time validation; it exposes table inputs to the resolver’s ambiguity-policy change. |
| apps/sim/lib/table/column-types/ttl.ts | Redirects TTL formatting through the shared timezone utility while retaining normalization through the table date path. |
| apps/sim/lib/core/utils/timezone.test.ts | Adds broad offset and DST coverage, including assertions that codify the changed fall-back ambiguity policy. |
| apps/sim/lib/table/dates.test.ts | Adds targeted coverage for localized inputs, invalid dates and times, DST transitions, and non-hour offsets. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Input[Naive table date or TTL input] --> Normalize[normalizeDateCellValue]
Normalize --> Stamp[zonedWallClockWithOffset]
Stamp --> Resolve[resolveZonedWallClock]
Resolve --> Candidate{Ambiguous DST overlap?}
Candidate -->|No| Instant[Resolved instant]
Candidate -->|Yes| Earlier[Select earliest exact candidate]
Earlier --> Persist[Persist date or TTL epoch]
Reviews (1): Last reviewed commit: 65d49f5 | Re-trigger Greptile
3a68f2d to
01e840a
Compare
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
01e840a to
fb99c64
Compare
fb99c64 to
01f58f2
Compare
01f58f2 to
acecea1
Compare
acecea1 to
d546727
Compare
d546727 to
45e020c
Compare
45e020c to
6e23875
Compare
6e23875 to
a658b61
Compare
a658b61 to
0dd6c72
Compare
08eba94 to
1b39fa7
Compare
8168a84 to
8825f1b
Compare
90dc736 to
cce1389
Compare
cce1389 to
f951e1b
Compare
f951e1b to
a0bfe2d
Compare
a0bfe2d to
d97a2cc
Compare
d97a2cc to
55169a7
Compare
55169a7 to
b09d5bf
Compare
Summary
Date and Expiration cells now share one wall-clock conversion path, so workspace and browser timezone changes cannot silently shift the stored instant. Invalid calendar rollovers are rejected. Nonexistent spring-forward wall times keep the existing scheduled-task and reporting behavior: they move forward by the DST gap, so
2:30 AMin New York becomes the real3:30 AMinstant.Expiration uses the later instant when a fall-back wall time occurs twice, while ordinary Date cells preserve their earlier-instant behavior. This asymmetry prevents a row from being deleted before the local time the user selected.
This is PR 3 of 4 in the row-expiration stack. It builds on the feature and global flag in PR #7071; PR #7161 adds row-delete triggers above it.
Type of Change
Testing
UTC,America/Los_Angeles,America/New_York, andAsia/Tokyoprocess timezones.bun run lint:check,bun run type-check, and all 33 repository audits pass.Checklist
Screenshots/Videos
No screenshots captured. Component tests cover the timezone-loading state and verify that editing waits for the resolved workspace or browser timezone.