
When running some tests on another project I stumbled upon a failed test that revealed a bug in colander's iso8601. If you try to deserialize "2014-09-09T15:15:57.516967" into a datetime object you get `datetime.datetime(2014, 9, 9, 15, 15, 57, 516966)` (notice the microseconds are off by 1). I traced it down to this: ``` groups["fraction"] = int(float("0.%s" % groups["fraction"]) * 1e6) ``` `int(float("0.%s" % "516967") * 1e6)` is equal to 516966 due to rounding. I was going to fix it, but iso8601 is a currently maintained project on pypi that has this issue (and possibly others) already fixed. So, it makes much more sense to offload everything back to that project. The only difference (besides the bug fixes) is following: `iso8601.Utc` => `iso8601.iso8601.Utc` `iso8601.FixedOffset` => `iso8601.iso8601.FixedOffset`
5 lines
159 B
Python
5 lines
159 B
Python
import iso8601
|
|
from iso8601.iso8601 import (parse_date, ParseError, Utc, FixedOffset, UTC, ZERO)
|
|
|
|
__all__ = ["parse_date", "ParseError", "Utc", "FixedOffset"]
|