Repository navigation
[Server] Add configurable timezone for log timestamps - #196
Merged
Merged
Conversation
openHAB writes log timestamps without a zone offset in the timezone set in its Regional Settings. The parser read them in the viewer process's timezone, so on a host running on UTC with openHAB set to e.g. America/New_York every timestamp was shifted by the zone difference. LOG_TIMEZONE (IANA name) makes the parser convert timestamps from that zone via Intl, independent of the process timezone, including DST fall-back/spring-forward edge cases and a per-minute offset cache. Unset keeps the previous behavior; an unknown name warns and falls back. The effective timezone is logged on startup. README now recommends the prebuilt release packages (Node.js 22+, no npm needed) and documents the timezone setting; ARCHITECTURE and the systemd unit are updated accordingly. Closes #195 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01H4dBTdvvGiQsgGDcxXr91d
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Pull Request
📖 Description
openHAB writes log timestamps without a zone offset, in the timezone configured in its Regional Settings. The parser interpreted them in the timezone of the viewer process, so on a host running on UTC with openHAB set to e.g.
America/New_York, every timestamp in the UI was shifted by the zone difference (4 hours in the reported case).This is a feature/fix with no breaking change:
LOG_TIMEZONE(IANA name). When set,LogLineParserconverts timestamps from that zone to UTC viaIntl.DateTimeFormat, independent of the process timezone. No new dependency.Reading log timestamps as …) to make offsets easy to diagnose from the journal.LOG_TIMEZONEin the configuration table and the env-file example.LOG_TIMEZONEexample.🎫 Issues
Closes #195
👩💻 Reviewer Notes
createZonedConverter()insrc/server/logLineParser.ts(candidate selection around DST transitions and the per-minute cache).TZ=UTC LOG_TIMEZONE=America/New_Yorkagainst a log containing2026-10-20 14:22:24.123 [INFO ] [a.b] - hello;/api/bootstrapreturns2026-10-20T18:22:24.123Z, and the UI shows 14:22 in a New York browser. This was verified locally.TZ=...are unaffected.📑 Test Plan
src/server/logLineParser.test.ts: newLogLineParser timezone handlingsuite covering the default process-local behavior, the issue Timestamp in LOG different that OS or wall clock time. #195 regression (EDT), standard time and zones east of UTC (Berlin, Kolkata, UTC), ambiguous fall-back times (New York, Berlin), the spring-forward gap, crossing a DST change within one parser (cache refresh), and continuation lines inheriting the zoned timestamp.src/server/config.test.ts:LOG_TIMEZONEdefault, valid value with spelling normalization, unknown zone fallback, whitespace-only value.src/server/routes.test.ts: config factory updated for the new field.UTC,America/New_York, andEurope/Berlin.✅ Checklist
General
npm testandnpm run typechecklocally and they pass.Server-specific (
src/server)src/server(tailer, parser, buffer, routes, SSE hub, config, etc.).src/server/types.tsin sync withsrc/client/state.tsfor any shared payload change (see ARCHITECTURE.md).⏭ Next Steps
None.