Skip to content

[Bug]: Maintenance window does not activate when using "Same as Server Timezone" in containerized deployments #261

@brewle

Description

@brewle

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

  • PostgreSQL

To Reproduce

  1. Deploy Peekaping in Kubernetes using official Helm chart with TZ=Europe/Kyiv in config env
  2. Create a Maintenance window with timezone Same as Server Timezone
  3. Set start/end time to current local time
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions