mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-10-23 20:32:24 +00:00
## Summary Implements issue #286 P1 frontend timestamp features on top of P0: - Added global timestamp timezone toggle in Display tab (`Local time` / `UTC`) - Added absolute-mode timestamp format presets (`iso`, `iso-seconds`, `locale`) - Added optional custom format input (only when `SITE_CONFIG.timestamps.allowCustomFormat === true`) - Extended `formatTimestamp()` / `formatTimestampWithTooltip()` behavior to honor timezone + format settings - Preserved server defaults with localStorage override precedence - Bumped `public/index.html` cache busters in same commit ## Details ### 1) Timezone toggle - New Display tab control persisted to `meshcore-timestamp-timezone` - Reads server default from `window.SITE_CONFIG.timestamps.timezone` with fallback to `local` - Formatting logic now supports both local and UTC absolute rendering ### 2) Format presets (absolute mode only) - New Display tab preset dropdown (shown only when timestamp mode = `absolute`) - Presets implemented: - `iso` → `YYYY-MM-DD HH:mm:ss` - `iso-seconds` → `YYYY-MM-DD HH:mm:ss.SSS` - `locale` → `toLocaleString()` (or UTC locale when timezone=utc) - Persisted to `meshcore-timestamp-format` - Reads server default from `window.SITE_CONFIG.timestamps.formatPreset` (fallback `iso`) ### 3) Custom format string (guarded) - Text input only renders when `window.SITE_CONFIG.timestamps.allowCustomFormat` is `true` - Persisted to `meshcore-timestamp-custom-format` - If non-empty and enabled, custom format overrides preset - Frontend intentionally does not hard-validate the format string; unsupported patterns fall back to preset behavior ## Tests Executed required test commands: ```bash node test-frontend-helpers.js node test-packet-filter.js node test-aging.js ``` Added coverage in `test-frontend-helpers.js` for: - UTC output behavior - Local output behavior - `iso-seconds` includes milliseconds - `locale` format behavior All passed locally. Refs #286 Co-authored-by: Kpa-clawbot <259247574+Kpa-clawbot@users.noreply.github.com>