~/talk

The Time Paradox: Building Timezone-Safe Python/Django

Talkat Django Day Copenhagen 2026 · on Friday, 2026-10-02· [django, web-platform]
slides:none on file

A production bug moves 47 payments out of Q1 because server-side queries run in UTC while payments are recorded with local offsets, so March 31 20:17 America/New_York becomes 00:17 UTC and lands in Q2. Root causes: Postgres’s session set local time zone comes from Django’s active TZ and Django/Postgres behavior when TIME_ZONE and USE_TZ interact. Fixes: store instants in UTC, store user intent as local time plus IANA tz, regenerate UTC when scheduling, use tz‑aware datetimes, and use a middleware that calls timezone.activate (read TZ from cookie/header/profile). Also prefer Postgres timestamp with time zone and ask for TZ on fiscal reports.

AI-written summary · about

  1. 0:00Introduction to time paradox
  2. 1:27Finance horror story explained
  3. 5:21What is a timestamp?
  4. 7:46Customer statement timing issue
  5. 9:31Recording past vs scheduling future
  6. 12:20Daylight saving time edge cases
  7. 14:08How long is a day?
  8. 15:15Naive vs timezone-aware datetimes
  9. 16:59PostgreSQL timezone handling
  10. 17:41Django timezone settings
  11. 19:08Dynamic timezone activation
  12. 21:36Three key timezone rules
  13. 23:02Q&A session begins
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.