Open rudigiesler opened 1 year ago
I guess we should not allow serialization of such datetimes at all then?
I don't think this problem would ever manifest in real life though, as all time zones have UTC offsets in 30 minute increments.
I think raising an exception when trying to serialize such datetimes is a good solution. Silently truncating data on serialization doesn't seem like a good solution, letting the user know that we can't serialise it, and having them truncate it before passing to us, sounds correct to me.
This was picked up from the hypothesis testing.
RFC3339 section 5.6 defines the timezone to consist of just hours and minutes, not seconds.
Python timezones support seconds, and when converting to a string using
isoformat
, includes the seconds.This is an issue if you try to decode it again, as you'll get an error that it is an invalid datetime string: