Skip to content

Add South Africa (SAST) timezone option and default; fix UTC-only clocks - #250

Closed
Poid-ZA wants to merge 1 commit into
smittix:mainfrom
Poid-ZA:fix/sast-default-timezone
Closed

Poid-ZA wants to merge 1 commit into
smittix:mainfrom
Poid-ZA:fix/sast-default-timezone

Conversation

@Poid-ZA

@Poid-ZA Poid-ZA commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • `InterceptTime` (the global timezone preference used across the app) only offered UTC / browser-local / US zones, defaulting to `US/Eastern`. Added `Africa/Johannesburg` (labelled SAST) as a selectable option in the settings modal and as the new default.

  • Fixed two clocks that bypassed `InterceptTime` entirely and always rendered raw UTC regardless of the user's preference:

    • the per-map HUD clock in `map-utils.js` (top-right overlay on every dashboard map)
    • the GPS fix-time readouts in `gps.js` (sidebar + visuals panel)

    Both now show local time (per `InterceptTime`, SAST by default) with UTC appended for reference, instead of UTC-only.

  • `templates/layout/base.html`'s header clock was fixed the same way for consistency, though no current route renders that template.

Non-SAST users are unaffected beyond the new default — anyone who already set a timezone preference in Settings keeps it (stored in `localStorage`); this only changes the out-of-the-box default and adds a previously-missing option.

Test plan

  • `node --check` on all three edited JS files
  • Manual review of `InterceptTime.onChange` wiring — no route currently renders `base.html`, so that portion is inert but consistent with the rest of the codebase

🤖 Generated with Claude Code

InterceptTime's global timezone preference only offered UTC, browser-local,
or US zones -- no way to select SAST, and it defaulted to US/Eastern. Added
Africa/Johannesburg (labelled SAST) as a selectable option and made it the
default, since this deployment and its primary user are South Africa-based.

Also fixed two clocks that bypassed InterceptTime entirely and hardcoded raw
UTC display regardless of user preference:
- map-utils.js's per-map HUD clock (top-right overlay)
- gps.js's GPS-fix timestamp readouts (sidebar + visuals panel)

Both now show the user's configured local time (SAST by default) with UTC
appended for reference, rather than UTC-only. templates/layout/base.html's
header clock (currently unused by any route, but defensively) was updated
the same way for consistency.
@smittix

smittix commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Thanks for this — the clock work is a real improvement and I want to take it.

The header clock, map HUD and GPS fix time all hardcoded UTC, and routing them through InterceptTime with a UTC fallback when it isn't loaded is the right shape. Adding SAST as an option is obviously fine too.

One change before I merge, in static/js/core/utils.js:

-let _timezone = localStorage.getItem('interceptTimezone') || 'US/Eastern';
+let _timezone = localStorage.getItem('interceptTimezone') || 'Africa/Johannesburg';

This changes the default for every user who hasn't explicitly chosen a timezone. US/Eastern being the current default is itself wrong, so I understand the instinct — but swapping it for Africa/Johannesburg trades one arbitrary regional default for another, and it would silently move existing users' clocks to SAST on update.

'local' is already in TZ_MAP (mapped to undefined, so Intl uses the browser's own zone) and is the neutral answer: everyone gets their own time without configuring anything, wherever they are.

Could you change that line to || 'local'? The several comments that mention "default SAST" would want a small update to match. Everything else in the PR is good to go as-is.

@smittix

smittix commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Thanks! The SAST timezone option and the UTC-only clock fixes (map HUD clock, GPS time respecting InterceptTime prefs) are genuinely useful and I'd like to take them. One change needed before merge: please don't change the global default timezone — this PR switches the default from US/Eastern to Africa/Johannesburg for all users. Could you keep the existing default (or, better, default to local) and just add SAST as a selectable option? With that adjusted + a rebase onto current main, this is good to go.

@smittix smittix closed this Oct 3, 2026
Poid-ZA added a commit to Poid-ZA/intercept that referenced this pull request Oct 6, 2026
Follows up on smittix#250. SAST stays a selectable zone, and the map HUD,
GPS fix times, and header clock use InterceptTime instead of raw UTC.
The out-of-the-box default stays browser-local, not a regional zone.
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.

2 participants