Repository navigation
Why are times stored without a time zone, and why is LocalDateTime.now() a bug? #598
Answered
by
lumenpearson
lumenpearson
asked this question in
Q&A
|
Bell times and lesson times are naive datetimes, with no UTC offset. In review I was told that |
Answered by
lumenpearson
Oct 17, 2026
Replies: 1 comment
|
Applies to: any version — this is how the project works by design. A timetable is wall-clock time at the school: a bell at 08:30 rings at 08:30 local time even when the zone's offset changes. Storage in UTC would shift that local time whenever the offset changes, gaining nothing.
The pull request template asks you to confirm that "now" is taken in the class's zone. More: https://github.com/lumenpearson/lessons/blob/main/docs/architecture.md#time |
0 replies
Answer selected by
lumenpearson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Applies to: any version — this is how the project works by design.
A timetable is wall-clock time at the school: a bell at 08:30 rings at 08:30 local time even when the zone's offset changes. Storage in UTC would shift that local time whenever the offset changes, gaining nothing.
SchoolClass.timezoneholds an IANA name, chosen in the bot fromserver/app/timezones.py.school_class.tz(now(school_class),today(school_class)inserver/app/services/clock.py).TIMEZONEis the fallback for an unset/unreadable class zone, and the zone for anything with no class yet (e.g. the owner's «📊 Проект»).…