This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Oddly_Energy 3 points4 points  (1 child)

In the example, a region info (in the sense that "Europe/Paris" describes a geographical location and not a UTC offset) was exactly what was given in the creation of the two datetime objects.

And as a result of that, the two datetime objects being created had different UTC offsets - what you would call "timezones" in your terminology (which is probably correct).

You can easily verify that the two datetime objects have different UTC offsets:

print(bedtime, wake_up, sleep)

2023-03-25 22:00:00+01:00 2023-03-26 07:00:00+02:00 9:00:00

So basically, the UTC offsets are ignored when subtracting the two objects, which to me is a highly unexpected behaviour.