Describe the bug
Maintenance window does not activate when timezone is set to Same as Server Timezone in containerized (Kubernetes/Docker) deployments. The issue is in time_utils.go where LoadTimezone resolves SAME_AS_SERVER using time.Now().Location().String() – which returns UTC in distroless/scratch images that lack tzdata and /usr/share/zoneinfo, even when TZ environment variable is set correctly.
Database
To Reproduce
- Deploy Peekaping in Kubernetes using official Helm chart with
TZ=Europe/Kyiv in config env
- Create a Maintenance window with timezone
Same as Server Timezone
- Set start/end time to current local time
- Observe that maintenance does not activate
Expected behavior
Maintenance window should activate at the specified local time. SAME_AS_SERVER should resolve timezone from the TZ environment variable, not from time.Now().Location().
Root cause
In apps/server/internal/modules/maintenance/utils/time_utils.go:
if timezone == "SAME_AS_SERVER" {
timezone = time.Now().Location().String() // always returns "UTC" in distroless images
}
time.Now().Location() returns UTC in containers without tzdata regardless of TZ env var.
Proposed fix
if timezone == "SAME_AS_SERVER" {
tz := os.Getenv("TZ")
if tz == "" {
tz = "UTC"
}
timezone = tz
}
Desktop:
- OS: Linux
- Browser: Chrome
- Version: 0.0.45
Additional context
Workaround: set timezone explicitly to UTC in maintenance form and input times in UTC manually.
Describe the bug
Maintenance window does not activate when timezone is set to
Same as Server Timezonein containerized (Kubernetes/Docker) deployments. The issue is intime_utils.gowhereLoadTimezoneresolvesSAME_AS_SERVERusingtime.Now().Location().String()– which returnsUTCin distroless/scratch images that lack tzdata and/usr/share/zoneinfo, even whenTZenvironment variable is set correctly.Database
To Reproduce
TZ=Europe/Kyivin config envSame as Server TimezoneExpected behavior
Maintenance window should activate at the specified local time.
SAME_AS_SERVERshould resolve timezone from theTZenvironment variable, not fromtime.Now().Location().Root cause
In
apps/server/internal/modules/maintenance/utils/time_utils.go:time.Now().Location()returnsUTCin containers without tzdata regardless ofTZenv var.Proposed fix
Desktop:
Additional context
Workaround: set timezone explicitly to
UTCin maintenance form and input times in UTC manually.