Skip to content

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

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

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

Conversation

@j15z

@j15z j15z commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

TTL and date cells now resolve wall-clock input through one core timezone implementation. This fixes browser/workspace-zone drift, invalid calendar rollover, and direction-dependent DST gap/fold handling while keeping epoch seconds stable when the display timezone changes.

This is the second PR in the stack and builds on PR #7071. It contains the shared conversion consolidation and its regression coverage.

Type of Change

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

Testing

  • Ran the 170-test timezone/date/TTL matrix under UTC, America/Los_Angeles, America/New_York, and Asia/Tokyo process timezones.
  • Covered New York, Berlin, and Lord Howe DST gaps and folds; Kathmandu and Lord Howe fractional-hour offsets; explicit workspace zones; browser fallback; localized input; invalid dates; and epoch round trips after display-zone changes.
  • Ran 273 relevant table, TTL cleanup, cron, import, and UI tests.
  • bun run check:api-validation, bun run check, and bunx turbo run lint:check --filter=sim pass.
  • Repository-wide TypeScript still reports the existing analytics globals and missing @c15t/scripts modules; it reports no errors in this PR's files.

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

Not applicable. This PR changes shared conversion logic and tests, not UI layout.

Post-Deploy Monitoring & Validation

  • Owner and window: Tables on-call for the first 24 hours after deploy.
  • Logs: search for Table row TTL cleanup completed and correlate any unexpected deletion reports with the stored TTL epoch and workspace timezone.
  • Metrics: watch cron/API success rate, async-job failures, and support/error reports for invalid date or early-expiration behavior.
  • Healthy signals: the same TTL epoch renders as the correct local wall time after workspace/browser timezone changes; expired rows delete only after that instant; invalid rollover dates are rejected.
  • Failure signals: an epoch changes after display-zone conversion, rows expire early or late near DST transitions, or impossible dates such as February 30 are accepted.
  • Mitigation: roll back this PR; if expiration timing is unsafe, also pause the TTL cleanup cron until stored epochs are verified.

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.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 26, 2026 6:21pm

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