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:
- Configuration: Add
tz field to Settings class that reads from the standard TZ environment variable
- Default: Defaults to
Europe/Berlin but can be configured to any IANA timezone
- Database: Uses SQLite's
datetime('now', 'localtime') which respects the system TZ setting
- Application: Uses Python's
zoneinfo.ZoneInfo for timezone-aware timestamp handling
- 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
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
Actual Behavior
Solution
Implemented configurable timezone support via the
TZenvironment variable:tzfield toSettingsclass that reads from the standardTZenvironment variableEurope/Berlinbut can be configured to any IANA timezonedatetime('now', 'localtime')which respects the system TZ settingzoneinfo.ZoneInfofor timezone-aware timestamp handlingConfiguration
Users can set the timezone in their
.envfile: