isodate
isodate copied to clipboard
Wrong datetime return
In [1]: import isodate
In [2]: isodate.parse_datetime("04-05-2015T14:32:00Z-09:00") Out[2]: datetime.datetime(401, 1, 1, 14, 32, tzinfo=<isodate.tzinfo.Utc object at 0x7fd4b4c46080>)
Hi,
"04-05-2015T14:32:00Z-09:00" this is a malformed iso date string.
The order of year, month, day is incorrect, and you have two time zone specifications in it 'Z' and '-09:00'.
I'll try to let the parser raise an exception.
Releated to #15
Related- timezones don't seem to ever parse, except for the Z timezone specification. This is an example, tested against isodate 0.6.0:
>>> isodate.parse_datetime("2019-03-20T13:30:00-5:00")
datetime.datetime(2019, 3, 20, 13, 30)
This should be returning a non-naive datetime with tzinfo on it, but it returns a naive datetime anyway.
Not that it should matter but America/Chicago is the local timezone of the system.
Is this project still maintained @gweis?
@estein-de This is malformed TZ spec. it should be "2019-03-20T13:30:00-05:00" (two digit hours in TZ spec. (so still related to #15)
Ad maintenance: It is still sort of maintained. There are a couple of issues I'd like to address, but I am a bit low on free time currently.
Oh thanks , #15 does seem like what I want - because then I would know it was malformed, the scary part is invalid data being misinterpreted
Can confirm, working fine with 2 digit hour
>>> isodate.parse_datetime("2019-03-20T13:30:00-05:00")
datetime.datetime(2019, 3, 20, 13, 30, tzinfo=<FixedOffset '-05:00'>)