gweis / isodate

ISO 8601 date/time parser
BSD 3-Clause "New" or "Revised" License
155 stars 59 forks source link

parse_date do not raise Exception on incorrect string (GPS format) #63

Open maximeLeurent opened 3 years ago

maximeLeurent commented 3 years ago

Hello,

I found that on some value of string , parse_date do not raise an Exception where it should. As i am using it in json hook it is problematique.

Example:

isodate.parse_date("16.263772,-61.2329") datetime.date(1601, 1, 1)

isodate.parse_date("100.263772,-61.2329") datetime.date(1001, 1, 1)

it does the same for any two (or more) digits number in before "."

Whereas date.fromisoformat do raise an error on those values.

I don't know if you will considere that as an issue.

Regards.

Gianfranco753 commented 3 years ago

I was just trying something similar.

>>> isodate.parse_date('202hghf01217gg')
datetime.date(2001, 1, 1)

But, if I throw gibberish on the start of the string, it raises an exception.

>>> isodate.parse_date('gfgf202hghf01217gg')
isodate.isoerror.ISO8601Error: Unrecognised ISO 8601 date format: 'gfgf202hghf01217gg'