fix(timezone): consolidate table wall-clock conversion - #7072
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
65d49f5 to
3a68f2d
比较
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
比较
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
比较
fb99c64 to
01f58f2
比较
01f58f2 to
acecea1
比较
acecea1 to
d546727
比较
d546727 to
45e020c
比较
45e020c to
6e23875
比较
6e23875 to
a658b61
比较
a658b61 to
0dd6c72
比较
cce1389 to
f951e1b
比较
f951e1b to
a0bfe2d
比较
a0bfe2d to
d97a2cc
比较
d97a2cc to
55169a7
比较
55169a7 to
b09d5bf
比较
b09d5bf to
900f36a
比较
900f36a to
5234bb2
比较
5234bb2 to
e4bc00c
比较
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 新建 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. The row editor waits for the resolved timezone and freezes it for the open edit, preventing a settings refresh from changing the committed instant. 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/新建_York, andAsia/Tokyoprocess timezones.bun run type-check,bun run lint:check,bun run check:api-validation, andbun run check:migrations origin/stagingpass.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.
Post-Deploy Monitoring & Validation