GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(utils): pick the timezone abbreviation from the UTC offset, not the formatted date by laoyyu · Pull Request #9923 · simstudioai/sim

Conversation

@laoyyu

@laoyyu laoyyu commented Nov 12, 2026

Copy link
Copy Markdown

What

getTimezoneAbbreviation decides between the standard and daylight label by comparing formatted strings:

const isDSTObserved = januaryFormatter.format(januaryDate) !== julyFormatter.format(julyDate)
...
const isDST = currentFormatter.format(date) !== januaryFormatter.format(januaryDate)

format() also renders the calendar date, which always differs between two dates, so for every zone in the map isDSTObserved was true and isDST was true too — the daylight label was returned all year:

getTimezoneAbbreviation('America/Los_Angeles', new Date('2026-01-15T12:00:00Z')) // 'PDT'
getTimezoneAbbreviation('Europe/London',        new Date('2026-01-15T12:00:00Z')) // 'BST'
getTimezoneAbbreviation('Australia/Sydney',     new Date('2026-07-15T12:00:00Z')) // 'AEDT'
formatDateTime(new Date('2026-01-15T12:00:00Z'), 'America/Los_Angeles')
// 'Jan 15, 2026, 4:00 AM PDT' — the local time is PST

Fix

Compare the zone's UTC offsets at the two ends of the year instead of formatted strings (getOffsetMinutes, derived from Intl.formatToParts, since Date has no timezone-aware offset accessor):

  • equal offsets → the zone does not observe DST → the standard label;
  • otherwise the smaller offset is standard time, and a larger offset on the target date means daylight time. Daylight time moves the clock forward in both hemispheres, so Sydney and Los Angeles are handled by the same rule.

How it was checked

  • packages/utils/src/formatting.test.ts gains four cases: winter/summer for northern zones, the inverted seasons for Australia/Sydney, and zones without DST (Asia/Tokyo, Asia/Singapore).
  • The same 13 zone/date expectations were executed on Node 22 against the patched logic: all hold (PST/PDT, GMT/BST, CET/CEST, EST/EDT, AEDT/AEST, JST, SGT).
  • tsc --noEmit --skipLibCheck on the patched file passes.

Fixes #9831. Prepared with an AI coding assistant; I reviewed the diff and ran the checks above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@laoyyu
fix(utils): pick the timezone abbreviation from the UTC offset, not t…
f618e58
…he formatted date

getTimezoneAbbreviation compared Intl.DateTimeFormat#format() results of two
dates in the same year. The formatted string always contains the calendar date,
so the comparison reported "DST is observed" for every zone and then "the target
date is daylight time" for every date: Los Angeles in January came out as PDT,
London as BST, Sydney in July as AEDT.

Compare the zone's UTC offsets at the two ends of the year instead. A zone whose
offsets match does not observe DST; otherwise the smaller offset is standard
time and any larger offset on the target date is daylight time, which covers
both hemispheres.
@vercel

vercel Bot commented Nov 12, 2026

Copy link
Copy Markdown

@laoyyu is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches time-zone labels in date formatting and schedule summaries.

The timezone fix appears sound, but the added comment must meet the repository's explicit rules before merging.

Findings

  1. P2 Comment records change history ▶

Summary

getTimezoneAbbreviation now compares UTC offsets instead of formatted dates.

  • Mapped time-zone abbreviations match the season of the requested date.

Reviews (1) · Last reviewed commit: "fix(utils): pick the timezone abbreviati..." · Reviewed by Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Nov 12, 2026
View reviewed changes
Comment thread packages/utils/src/formatting.ts
Comment on lines +60 to +62
// Compare the zone's UTC offsets across the year: `format()` always
// includes the calendar date, so comparing formatted strings reported
// "DST observed" for the whole year and then "daylight" for every date.

@greptile-apps greptile-apps Bot Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

P2 Comment records change history

The new comment recounts the previous bug, but CLAUDE.md says change history belongs in commit messages. Keep the explanation that format() includes the calendar date and remove the account of the old behavior. This repository requirement must be satisfied before merging.

Suggested change
// Compare the zone's UTC offsets across the year: `format()` always
// includes the calendar date, so comparing formatted strings reported
// "DST observed" for the whole year and then "daylight" for every date.
// Compare UTC offsets because `format()` also includes the calendar date.

Context Used: CLAUDE.md (source)

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!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG] Timezone formatter labels winter dates with daylight-time abbreviations

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@laoyyu
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.