2 ms·
Thanks for the info. I've confirmed this for myself now: class Offset(tzinfo): def __init__(self, offset): self.offset = offset de
by jessaustin 13y ago
Thanks for the info. I've confirmed this for myself now:
class Offset(tzinfo):
def __init__(self, offset):
self.offset = offset
def utcoffset(self, dt):
return self.offset
>>> bool(time(1, 0, tzinfo=Offset(timedelta(hours=1))))
False
>>> bool(time(23, 0, tzinfo=Offset(timedelta(hours=-1))))
True
Although this is kind of funny, because for time.hour, 23 and -1 should be the same thing:
>>> bool(time(23, 0, tzinfo=Offset(timedelta(hours=23))))
False
I'm convinced: legacy behavior is wrong and should be changed.