Skip to content

feat(analytics): Packets / Hour labels follow the viewer's locale - #40

Open
A13xB0 wants to merge 2 commits into
fix/packets-per-hour-long-spanfrom
feat/pph-viewer-locale
Open

A13xB0 wants to merge 2 commits into
fix/packets-per-hour-long-spanfrom
feat/pph-viewer-locale

Conversation

@A13xB0

@A13xB0 A13xB0 commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Requires #39 first (upstream Kpa-clawbot#2194). This PR is based on that branch, so the diff shows only its own two commits. Fork only; not for upstream.

What

The Packets / Hour labels follow the person viewing:

  • Dates use their locale's format: 18/06 in the UK, 06/18 in the US.
  • Hours use their clock: 15:00, or 3:00 PM.
  • Timezone: bars and labels sit on the viewer's own clock (days split at their midnight), unless the app's timezone setting (Customize → Timestamps) is UTC. Without this, a label would show a UTC time in a local format.

Screenshots

The issue's 124-day data from Kpa-clawbot#2193, on the e2e fixture.

UK (en-GB, Europe/London):

UK

US (en-US, America/New_York):

US

The bars differ slightly between the two because US days split at New York midnight.

Change

public/analytics.js, packetsPerHourCard() only (+12/−5):

  • labels via Intl.DateTimeFormat with the browser's locale;
  • buckets aligned to the viewer's UTC offset when the timezone setting is local. Half-hour zones such as India still get labels on round local hours.

Tests

tests/unit/test-issue-2193-packets-per-hour.js, red then green: UK dates read dd/mm, US dates read mm/dd, and 12:00 vs 12:00 PM. sh test-all.sh passes. Checked by hand in Asia/Kolkata, America/New_York and Europe/London.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H

@A13xB0 A13xB0 added enhancement New feature or request upstream: not submitted Fork only so far; not opened upstream labels Oct 12, 2026
A13xB0 and others added 2 commits October 15, 2026 10:20
Dates read dd/mm for a UK viewer and mm/dd for a US one; hours follow the
viewer's clock (15:00 or 3:00 PM).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
Dates and hours use the viewer's own format (14/09 or 09/14, 15:00 or
3:00 PM), and the bars and labels sit on their own clock unless the app's
timezone setting is UTC, so a label never shows a UTC time in a local
format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
@A13xB0
A13xB0 force-pushed the feat/pph-viewer-locale branch from 118e5af to caac33c Compare October 15, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request upstream: not submitted Fork only so far; not opened upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant