Skip to content

fix: use dynamic timezone abbreviation in PR comment timestamp - #209

Merged
Voziv merged 1 commit into
mainfrom
fix/187-timezone-label
May 24, 2026
Merged

Voziv merged 1 commit into
mainfrom
fix/187-timezone-label

Conversation

@Voziv

@Voziv Voziv commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

Fixes #187. The PR comment timestamp formats the time using the configured timezone input but appends a hardcoded PT label:

_Updated at ${new Date().toLocaleString('en-CA', { timeZone: actionInput.timezone })} PT_

The time shifts with the timezone; the PT label never does. Since the timezone input defaults to America/Toronto (Eastern), the label is already wrong out of the box.

Fix

Drop the literal and let Intl emit the matching abbreviation via the timeZoneName: 'short' option.

timezone before after
America/Toronto (default) … p.m. PT ❌ … p.m. EDT ✅
America/Los_Angeles … p.m. PT … p.m. PDT
Europe/Berlin … p.m. PT ❌ … p.m. GMT+2
UTC … p.m. PT ❌ … p.m. UTC

For IANA zones without a common abbreviation, Intl falls back to a GMT±N offset — still correct.

Notes

  • dist/index.js is intentionally not included; semantic-release regenerates dist/** on release.
  • pnpm run build and pnpm run lint pass. No tests assert on this string.

The PR comment timestamp formatted the time with the configured
timezone but appended a hardcoded "PT" label, so any non-Pacific
timezone (including the America/Toronto default) showed the correct
time with a misleading label.

Use Intl's timeZoneName: 'short' option to emit the matching
abbreviation instead.

Closes #187
@github-actions

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟢 Statements 88.39% 137/155
🟡 Branches 77.61% 52/67
🟢 Functions 91.18% 31/34
🟢 Lines 88.31% 136/154

Test suite run success

28 tests passing in 4 suites.

Report generated by 🧪jest coverage report action from dfdc3bf

@Voziv
Voziv merged commit 81f8e40 into main May 24, 2026
5 checks passed
@Voziv
Voziv deleted the fix/187-timezone-label branch May 24, 2026 01:12
argocd-diff-action-bot Bot pushed a commit that referenced this pull request May 24, 2026
## [0.6.12](0.6.11...0.6.12) (2026-05-24)

### ⚠ BREAKING CHANGES

* run on Node 24 runtime and upgrade dependencies (#208)

### Build & Dependencies

* **deps-dev:** upgrade pnpm to 11.2.2 ([#207](#207)) ([f69a1e6](f69a1e6))

### Documentation

* add CLAUDE.md ([664ab77](664ab77))

### Features

* run on Node 24 runtime and upgrade dependencies ([#208](#208)) ([13477ad](13477ad)), closes [#175](#175)

### Bug Fixes

* use dynamic timezone abbreviation in PR comment timestamp ([#209](#209)) ([81f8e40](81f8e40))

[skip release]
@argocd-diff-action-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.6.12 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time zone is set dynamically but always prints the time with "PT" as the timezone

1 participant

Sponsor
SponsoredKunjungi sekarang
Promo