isodate icon indicating copy to clipboard operation
isodate copied to clipboard

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

Open maximeLeurent opened this issue 4 years ago • 1 comments

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.

maximeLeurent avatar Nov 13 '20 14:11 maximeLeurent

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'

Gianfranco753 avatar Jan 08 '21 14:01 Gianfranco753