Skip to content

fix(timezone): consolidate table wall-clock conversion - #7072

Open
j15z wants to merge 7 commits into
feat/table-row-ttlfrom
refactor/consolidate-timezone-math
Open

fix(timezone): consolidate table wall-clock conversion#7072
j15z wants to merge 7 commits into
feat/table-row-ttlfrom
refactor/consolidate-timezone-math

Conversation

@j15z

@j15z j15z commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

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 AM in New York becomes the real 3:30 AM instant.

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • The 170-test timezone/date/Expiration matrix passes under UTC, America/Los_Angeles, America/New_York, and Asia/Tokyo process timezones.
  • Coverage includes New York, Berlin, and Lord Howe gaps and folds; Kathmandu and Lord Howe fractional-hour offsets; workspace timezone changes; browser fallback; localized input; invalid dates; and epoch round trips.
  • The latest focused timezone, date, import, and inline-editor suites pass 166 tests after the stack was restacked.
  • bun run lint:check, bun run type-check, and all 33 repository audits pass.
  • Review focus: Expiration must choose the safe later instant for ambiguous times without changing existing Date semantics.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

No screenshots captured. Component tests cover the timezone-loading state and verify that editing waits for the resolved workspace or browser timezone.


Compound Engineering

@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 28, 2026 11:03pm

Request Review

@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 65d49f5 to 3a68f2d Compare August 25, 2026 19:11
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR consolidates table wall-clock conversion and timezone formatting into the shared timezone utility, while tightening date validation and expanding timezone-focused tests.

  • Adds shared instant formatting, offset formatting, wall-clock extraction, and DST resolution.
  • Routes table date and TTL normalization through the shared resolver.
  • Adds coverage for fractional-hour offsets, DST gaps and overlaps, invalid calendar values, and timezone round trips.

Confidence Score: 4/5

The 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

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: 65d49f5 | Re-trigger Greptile

Comment thread apps/sim/lib/core/utils/timezone.ts Outdated
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 3a68f2d to 01e840a Compare August 25, 2026 19:15

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/sim/lib/table/dates.ts
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 01e840a to fb99c64 Compare August 25, 2026 19:35
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from fb99c64 to 01f58f2 Compare August 25, 2026 19:46
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 01f58f2 to acecea1 Compare August 25, 2026 19:59
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from acecea1 to d546727 Compare August 26, 2026 18:21
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from d546727 to 45e020c Compare August 26, 2026 19:53
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 45e020c to 6e23875 Compare August 26, 2026 20:02
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 6e23875 to a658b61 Compare August 26, 2026 21:32
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from a658b61 to 0dd6c72 Compare August 26, 2026 21:52
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 08eba94 to 1b39fa7 Compare August 26, 2026 22:45
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from 8168a84 to 8825f1b Compare August 27, 2026 21:23
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch 2 times, most recently from 90dc736 to cce1389 Compare August 27, 2026 21:57
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from cce1389 to f951e1b Compare August 28, 2026 02:05
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from f951e1b to a0bfe2d Compare August 28, 2026 02:23
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from a0bfe2d to d97a2cc Compare August 28, 2026 02:35
@j15z
j15z force-pushed the refactor/consolidate-timezone-math branch from d97a2cc to 55169a7 Compare August 28, 2026 22:20
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.

1 participant