🎨 Showed site timezone, instead of device timezone, in post analytics#26229
🎨 Showed site timezone, instead of device timezone, in post analytics#26229troyciesco merged 2 commits intomainfrom
Conversation
📝 WalkthroughWalkthroughThis pull request introduces timezone-aware date and time formatting functionality. It adds a Changes
Sequence DiagramsequenceDiagram
participant Header as PostAnalyticsHeader
participant Global as Global Data
participant TZ as getSiteTimezone
participant Format as formatDisplayTime
participant UI as Rendered Output
Header->>Global: Retrieve settings
Global-->>Header: settings array
Header->>TZ: getSiteTimezone(settings)
TZ-->>Header: timezone string
Header->>Format: formatDisplayTime(published_at, timezone)
Format-->>Header: formatted time string
Header->>UI: Render with timezone-aware time
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
towards https://linear.app/ghost/issue/NY-951 Previously, post analytics showed the time in the device's timezone. Now, they show the time in the site's timezone.
8f0977d to
dc937d7
Compare
| * // 7:09pm | ||
| */ | ||
| export const formatDisplayTime = (dateString: string, timezone: string): string => ( | ||
| moment(dateString).tz(timezone).format('h:mma') |
There was a problem hiding this comment.
Note that this uses 12-hour time, not 24-hour time, like before. Happy to revert.
troyciesco
left a comment
There was a problem hiding this comment.
lgtm - just noting i saw the year disappeared too in the new version, but that looks correct with how that function works (i.e. doesn't show currentYear)
…TryGhost#26229) towards https://linear.app/ghost/issue/NY-951 | Before (device in America/Chicago) | After (site in Pacific/Honolulu) | |---|---| |  |  | Previously, post analytics showed the time in the device's timezone. Now, they show the time in the site's timezone.


towards https://linear.app/ghost/issue/NY-951
Previously, post analytics showed the time in the device's timezone. Now, they show the time in the site's timezone.
Summary by CodeRabbit
Release Notes
New Features
Tests