Skip to content

bug: Timezone handling in Docker container - timestamps show UTC instead of local timezone #22

@andreas-vester

Description

@andreas-vester

Problem

When deploying the Docker container and submitting a new application, timestamps are displayed in UTC (or the container's default timezone) instead of the configured local timezone (e.g., Europe/Berlin). This causes timestamps in emails and the archive to be off by several hours.

Expected Behavior

  • Application submission timestamps should reflect the configured timezone
  • Email notifications should display times in the configured timezone
  • Vote timestamps should be recorded in the configured timezone

Actual Behavior

  • Timestamps display in UTC (or the container's system timezone)
  • For Europe/Berlin, timestamps are one hour behind (showing London time instead)

Solution

Implemented configurable timezone support via the TZ environment variable:

  1. Configuration: Add tz field to Settings class that reads from the standard TZ environment variable
  2. Default: Defaults to Europe/Berlin but can be configured to any IANA timezone
  3. Database: Uses SQLite's datetime('now', 'localtime') which respects the system TZ setting
  4. Application: Uses Python's zoneinfo.ZoneInfo for timezone-aware timestamp handling
  5. Email: Converts all timestamps to the configured timezone before formatting

Configuration

Users can set the timezone in their .env file:

TZ=Europe/Berlin      # Default
TZ=America/New_York   # Example
TZ=Asia/Tokyo         # Example
TZ=UTC                # UTC timezone

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions