Skip to content

fix(renderer): timestamps follow a system time-zone change - #2466

Merged
arul28 merged 2 commits into
mainfrom
fix/local-time-formatters
Nov 23, 2026
Merged

arul28 merged 2 commits into
mainfrom
fix/local-time-formatters

Conversation

@arul28

@arul28 arul28 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Why

Four module-level Intl.DateTimeFormat instances were built without a timeZone, so they froze the zone the app loaded in. After a system time-zone change, an inline <time> chip in assistant prose, the lane-share "Ends …" label and the issue due-date label kept the old zone until a restart; the due-date label could show the wrong calendar day.

Same defect class as pingdotgg/t3code#32371, verified against ADE's formatters. The main chat timestamp cache already rebuilds every minute and was left alone.

What changed

Those four formatters are pinned to UTC and format a wall-clock-shifted Date, so the output is still local time but follows the current zone with no rebuild timer. The same-day check, field sets, locale and output for an unchanged zone are identical.

Evidence

  • threadEntities and laneShareModel suites pass (38 tests).
  • npm --prefix apps/desktop run typecheck passes.
  • The shift is a pure function of Date.getTimezoneOffset(), read at format time.

Not checked

No new test: the affected formatters had no display tests, and a process.env.TZ test would be machine-dependent. Not exercised with a live OS zone change. Full CI matrix not run locally.

🤖 Generated with Claude Code

ADE   Open in ADE  ·  fix/local-time-formatters branch  ·  PR #2466


Devin Review

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the earlier non-blocking test-coverage concern still open.

Fix All in Claude CodeFindings

  1. P2 Time-zone changes lack coverage ▶
Fix with agent prompt
### Issue 1
apps/desktop/src/shared/formatting.ts:78-79
The new time-zone behavior has no regression test. The existing suites do not call `wallClockAsUtc`, `formatThreadEntityTimestamp`, or `formatLaneShareEnd`, so passing them does not check this fix. CI could miss stale labels or an incorrect offset shift.

Add a test that loads the formatters in one fixed zone, switches to another, and checks the next output. Also cover dates on both sides of a daylight-saving change.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Updates cached date formatters so labels use the current local time zone when formatted.

  • Assistant timestamps follow the current time zone while ADE stays open.
  • Lane-share end labels follow the current time zone.
  • Issue due-date labels follow the current time zone.

Reviews (2) · Last reviewed commit: "fix(renderer): build the wall-clock date..." · Reviewed by Greptile

Four module-level Intl.DateTimeFormat instances were built without a
timeZone, so they froze the zone the app loaded in: an inline <time> chip in
assistant prose, the lane-share "Ends …" label and the issue due-date label
kept the old zone until a restart, and the due-date label could show the
wrong calendar day.

Pin them to UTC and format a wall-clock-shifted Date, so the output is local
time that follows the current zone with no rebuild timer. The chat
transcript cache already rebuilds every minute and is unchanged.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3daa933 and cae6f2d.

Files selected for processing: 4

  • apps/desktop/src/renderer/components/issues/issueDueDatePicker.tsx
  • apps/desktop/src/renderer/components/laneShare/laneShareModel.ts
  • apps/desktop/src/shared/formatting.ts
  • apps/desktop/src/shared/threadEntities.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +78 to +80
export function wallClockAsUtc(date: Date): Date {
return new Date(date.getTime() - date.getTimezoneOffset() * 60_000);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Incorrect historical timestamps in chat

For historical instants with sub-minute zone offsets, wallClockAsUtc drops the offset seconds. Chat timestamps near a minute boundary then display the wrong minute even when the system zone never changes.

Learn more

timeEntity accepts valid zoned ISO timestamps from assistant prose without a lower date bound. ThreadEntityNode displays those instants with formatThreadEntityTimestamp. The previous formatter applied the zone's historical offset directly. The new helper uses getTimezoneOffset(), which returns whole minutes and drops offset seconds before the UTC formatter chooses what minute to print.

Example: With the system zone set to Europe/Paris, an assistant reply containing 1900-01-01T12:00:45Z previously displayed Jan 1, 12:10 PM in en-US. Paris used UTC+00:09:21 at that instant. The new helper shifts by nine minutes, so the same reply displays Jan 1, 12:09 PM.

Recommended fix: Copy the local calendar and clock fields into a UTC date instead of shifting by getTimezoneOffset(). Use setUTCFullYear to avoid JavaScript's special handling of years 0–99 in Date.UTC.

Suggested change
export function wallClockAsUtc(date: Date): Date {
return new Date(date.getTime() - date.getTimezoneOffset() * 60_000);
}
export function wallClockAsUtc(date: Date): Date {
const wallClock = new Date(0);
wallClock.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());
wallClock.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
return wallClock;
}

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread apps/desktop/src/shared/formatting.ts Outdated
Comment on lines +78 to +79
export function wallClockAsUtc(date: Date): Date {
return new Date(date.getTime() - date.getTimezoneOffset() * 60_000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Time-zone changes lack coverage

The new time-zone behavior has no regression test. The existing suites do not call wallClockAsUtc, formatThreadEntityTimestamp, or formatLaneShareEnd, so passing them does not check this fix. CI could miss stale labels or an incorrect offset shift.

Add a test that loads the formatters in one fixed zone, switches to another, and checks the next output. Also cover dates on both sides of a daylight-saving change.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/shared/formatting.ts
Line: 78-79

Comment:
**Time-zone changes lack coverage**

The new time-zone behavior has no regression test. The existing suites do not call `wallClockAsUtc`, `formatThreadEntityTimestamp`, or `formatLaneShareEnd`, so passing them does not check this fix. CI could miss stale labels or an incorrect offset shift.

Add a test that loads the formatters in one fixed zone, switches to another, and checks the next output. Also cover dates on both sides of a daylight-saving change.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Review follow-up: `Date.getTimezoneOffset()` truncates to whole minutes, so
the offset arithmetic lost historical sub-minute (local-mean-time) offsets
and could shift a old timestamp or due date by up to 59 seconds. Copy the
local calendar and clock fields into a UTC date instead; it still follows a
live zone change because the local getters read the current zone.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@arul28
arul28 merged commit 991fd9f into main Nov 23, 2026
28 checks passed
@arul28
arul28 deleted the fix/local-time-formatters branch November 23, 2026 08:11
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