News for hackers. Stuff that matters.
Re:Ten Python datetime pitfalls, and what libraries are (not... by magicalhippo on Sunday February 18, 2024 @03:18PM (#39422716)
> If you allow addition, you may be tempted to think you can "just add three hours" and get 04:00:00+01:00. However, because Paris has a DST transition, you'd actually want to have 05:00:00+02:00

Since you know the offset then adding three hours should be unambiguous no? Convert to UTC, add three hours, convert back to target timezone, which would net you the correct 05:00:00+02:00.

Re:Ten Python datetime pitfalls, and what libraries are (not... by Hackbraten on Sunday February 18, 2024 @04:01PM (#39423288)
> Convert to UTC, add three hours, convert back to target timezone

What if you don't even know the target offset?

You may happen to know it for an event three hours in the future, but what if you're adding three months? With that time frame, the relevant laws even may not have been passed yet.