local-time: the panel in the container's zone, named on Settings
Agreed by the owner on 2026-10-13 (the local day, no "UTC" beside a
time); the zone is the container's TZ in .env and Settings only shows it,
his "Да" of 2026-10-17. Mockups c205106.
Every time the panel shows is formatted in time.Local and says no zone:
the logs' Time and the DMARC Received columns, a message's timeline,
Overview's "Updated", Health's certificate and renewal, the filter lists,
DMARC reports and windows, the auto limit's last recalculation. Stored
instants stay UTC. The days counted are the zone's: delivery_log_days and
sender_check_days key their rows by the local date, the sender check cuts
downtime at local midnights (byDay), the log filters' days run from local
midnight to local midnight. Notification mail and the test message write
the zone's abbreviation after a time - they are read away from the panel.
DMARC's one-day window label stays the reporter's (UTC) day.
Settings box 05, Time zone, read-only: the name (UTC without TZ), its
offset, and a TZ the image cannot load said to leave the times in UTC
(time/zoneinfo_unix.go, initLocal) rather than named. TZ is passed by the
compose file ("${TZ:-}"), in .env.example and the guide's table; tzdata is
named in the image (supervisor's python3.13 brings it today). Postfix
takes TZ through import_environment, so mail.log's stamps are the same
zone, which closes the trap the roadmap wrote down: the tailer has always
read them in time.Local.
Tests: a TestMain runs view, handlers, store and cmd/panel in UTC whatever
the machine's zone (as logtail's); TestSettingsShowsTheTimeZone,
TestTimesAreTheContainersZone, TestByDayInTheContainersZone, a Moscow day
in TestQueryInboundSpamFilters; envdoc's pattern takes two-letter names.
e2e time_zone_is_the_containers recreates the stand with
TZ=Europe/Moscow: date says MSK, Settings names the zone and UTC+03:00, a
test message's page gives its time and its mail.log lines in Moscow's.
go vet + go test (26 packages) and make e2e on the test server for this
tree.
Docs: guide (§ Settings, the TZ row, the days of Health and the logs),
architecture, schema-migrations, help (word for word with the mockup),
CHANGELOG [Unreleased] § Added, roadmap row done with the decision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -215,7 +215,8 @@ func TestQueryInboundSpamFilters(t *testing.T) {
|
||||
if got := to(InboundSpamFilter{Decision: SpamDecisionReject}); got != "25" {
|
||||
t.Errorf("decision = %q, want 25", got)
|
||||
}
|
||||
// Days are whole UTC days and both ends are in: 21 st is 00:00 up to 23:59.
|
||||
// Days are whole days of the container's zone (UTC here, TestMain) and
|
||||
// both ends are in: 21 st is 00:00 up to 23:59.
|
||||
if got := to(InboundSpamFilter{Since: day(21, 15), Until: day(21, 3)}); got != "32" {
|
||||
t.Errorf("one day = %q, want 32", got)
|
||||
}
|
||||
@@ -225,10 +226,11 @@ func TestQueryInboundSpamFilters(t *testing.T) {
|
||||
if got := to(InboundSpamFilter{Until: day(20, 0)}); got != "15" {
|
||||
t.Errorf("until = %q, want 15", got)
|
||||
}
|
||||
// A time in another zone is read as the UTC day it falls on.
|
||||
// A day is the date it carries, whatever zone the time is in: the 22nd at
|
||||
// 02:00 in Moscow is the 22nd.
|
||||
msk := time.FixedZone("msk", 3*3600)
|
||||
if got := to(InboundSpamFilter{Since: time.Date(2026, 9, 22, 2, 0, 0, 0, msk)}); got != "432" {
|
||||
t.Errorf("since in another zone = %q, want 432 (it is the 21st in UTC)", got)
|
||||
if got := to(InboundSpamFilter{Since: time.Date(2026, 9, 22, 2, 0, 0, 0, msk)}); got != "4" {
|
||||
t.Errorf("since in another zone = %q, want 4 (the 22nd)", got)
|
||||
}
|
||||
if got := to(InboundSpamFilter{Domain: "b.example", Decision: SpamDecisionAccept, Since: day(21, 0), Until: day(21, 0)}); got != "3" {
|
||||
t.Errorf("all filters = %q, want 3", got)
|
||||
@@ -260,6 +262,14 @@ func TestQueryInboundSpamFilters(t *testing.T) {
|
||||
if got := to(InboundSpamFilter{Domain: "a.example' OR '1'='1"}); got != "" {
|
||||
t.Errorf("injected domain = %q", got)
|
||||
}
|
||||
|
||||
// In a container with TZ=Europe/Moscow the 21st is that zone's: from 20 Sep
|
||||
// 21:00 UTC, so it takes the row of the 20th at 23:00 UTC and leaves the
|
||||
// 22nd's at 00:00 UTC, which is 03:00 there.
|
||||
inZone(t, "Europe/Moscow")
|
||||
if got := to(InboundSpamFilter{Since: day(21, 0), Until: day(21, 0)}); got != "321" {
|
||||
t.Errorf("one day in Moscow = %q, want 321", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListSpamListHits(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user