gbif / parsers

Various GBIF parsers for dates, countries, language, taxon ranks, etc
Apache License 2.0
4 stars 8 forks source link

2002-03-10 00:00:00.0 cannot be parsed #29

Open qifeng-bai opened 4 years ago

qifeng-bai commented 4 years ago

Do we still support 2002-03-10 00:00:00.0 format?

If I remember correctly, 2002-03-10 00:00:00.0 was parsed correctly before.

It matches the NUMERICAL_DATE_PATTERN, and then failed.

if (NUMERICAL_DATE_PATTERN.matcher(input).matches()) { return NUMERICAL_DATE_PARSER.parse(input, DateComponentOrdering.ISO_ETC); https://github.com/gbif/parsers/blob/master/src/main/java/org/gbif/common/parsers/date/TextDateParser.java#L62 Screen Shot 2020-09-16 at 5 12 15 pm

MattBlissett commented 4 years ago

https://github.com/gbif/parsers/blob/master/src/main/java/org/gbif/common/parsers/date/ThreeTenNumericalDateParser.java#L101

I'd expect it to match using that pattern, so this is a bug if it's not working.

qifeng-bai commented 4 years ago

@MattBlissett I tried : DateParsers.defaultNumericalDateParser().parse("2002-03-10 00:00:00.0"), which uses. ThreeTenNumericalDateParser, failed,

DateParsers.defaultNumericalDateParser().parse("2002-03-10T00:00:00.0") , this format works

Screen Shot 2020-09-17 at 10 54 20 am