cquiroz / scala-java-time

Implementation of the `java.time` API in scala. Especially useful for scala.js
http://cquiroz.github.io/scala-java-time/
BSD 3-Clause "New" or "Revised" License
125 stars 33 forks source link

Isues with parsing #486

Open sideeffffect opened 10 months ago

sideeffffect commented 10 months ago

From https://github.com/zio/zio-schema/pull/579#discussion_r1404426353

False negatives:

Error parsing time 00:00:00 AM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 00:00:00 AM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 10:00:00 AM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '10:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 12:00:00 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '12:00:00 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:09:09 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '12:09:09 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:59:59 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '12:59:59 PM' could not be parsed, unparsed text found at index 9
Error parsing time 13:09:09 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '13:09:09 PM' could not be parsed, unparsed text found at index 9
Error parsing time 20:20:20 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '20:20:20 PM' could not be parsed, unparsed text found at index 9
Error parsing time 22:22:22 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '22:22:22 PM' could not be parsed, unparsed text found at index 9
Error parsing time 23:59:00 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '23:59:00 PM' could not be parsed, unparsed text found at index 9
Error parsing time 23:59:59 PM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '23:59:59 PM' could not be parsed, unparsed text found at index 9
Error parsing time 24:00:00 AM with format HH:mm:ss a: java.time.format.DateTimeParseException: Text '24:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 0:0:0 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '0:0:0 AM' could not be parsed, unparsed text found at index 6
Error parsing time 1:1:1 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '1:1:1 AM' could not be parsed, unparsed text found at index 6
Error parsing time 00:00:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 00:00:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 10:00:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '10:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 12:00:00 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '12:00:00 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:09:09 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '12:09:09 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:59:59 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '12:59:59 PM' could not be parsed, unparsed text found at index 9
Error parsing time 13:09:09 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '13:09:09 PM' could not be parsed, unparsed text found at index 9
Error parsing time 20:20:20 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '20:20:20 PM' could not be parsed, unparsed text found at index 9
Error parsing time 22:22:22 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '22:22:22 PM' could not be parsed, unparsed text found at index 9
Error parsing time 23:59:00 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '23:59:00 PM' could not be parsed, unparsed text found at index 9
Error parsing time 23:59:59 PM with format H:m:s a: java.time.format.DateTimeParseException: Text '23:59:59 PM' could not be parsed, unparsed text found at index 9
Error parsing time 0:00:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '0:00:00 AM' could not be parsed, unparsed text found at index 8
Error parsing time 1:11:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '1:11:00 AM' could not be parsed, unparsed text found at index 8
Error parsing time 24:00:00 AM with format H:m:s a: java.time.format.DateTimeParseException: Text '24:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 00:00:00 AM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 00:00:00 AM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 10:00:00 AM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '10:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 12:00:00 PM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '12:00:00 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:09:09 PM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '12:09:09 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:59:59 PM with format hh:mm:ss a: java.time.format.DateTimeParseException: Text '12:59:59 PM' could not be parsed, unparsed text found at index 9
Error parsing time 0:0:0 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '0:0:0 AM' could not be parsed, unparsed text found at index 6
Error parsing time 1:1:1 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '1:1:1 AM' could not be parsed, unparsed text found at index 6
Error parsing time 00:00:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 00:00:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '00:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 01:01:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '01:01:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 10:00:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '10:00:00 AM' could not be parsed, unparsed text found at index 9
Error parsing time 12:00:00 PM with format h:m:s a: java.time.format.DateTimeParseException: Text '12:00:00 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:09:09 PM with format h:m:s a: java.time.format.DateTimeParseException: Text '12:09:09 PM' could not be parsed, unparsed text found at index 9
Error parsing time 12:59:59 PM with format h:m:s a: java.time.format.DateTimeParseException: Text '12:59:59 PM' could not be parsed, unparsed text found at index 9
Error parsing time 0:00:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '0:00:00 AM' could not be parsed, unparsed text found at index 8
Error parsing time 1:11:00 AM with format h:m:s a: java.time.format.DateTimeParseException: Text '1:11:00 AM' could not be parsed, unparsed text found at index 8
Error parsing time 00:00:00 000000000 AM with format HH:mm:ss SSSSSSSSS a: java.time.format.DateTimeParseException: Text '00:00:00 000000000 AM' could not be parsed, unparsed text found at index 19
Error parsing time 01:01:00 000000001 AM with format HH:mm:ss SSSSSSSSS a: java.time.format.DateTimeParseException: Text '01:01:00 000000001 AM' could not be parsed, unparsed text found at index 19
Error parsing time 13:09:09 100000000 PM with format HH:mm:ss SSSSSSSSS a: java.time.format.DateTimeParseException: Text '13:09:09 100000000 PM' could not be parsed, unparsed text found at index 19
Error parsing time 20:20:20 123456789 PM with format HH:mm:ss SSSSSSSSS a: java.time.format.DateTimeParseException: Text '20:20:20 123456789 PM' could not be parsed, unparsed text found at index 19
Error parsing time 23:59:00 222222222 PM with format HH:mm:ss SSSSSSSSS a: java.time.format.DateTimeParseException: Text '23:59:00 222222222 PM' could not be parsed, unparsed text found at index 19
Error parsing time 24:00:00 000000000 AM with format HH:mm:ss SSSSSSSSS a: java.time.format.DateTimeParseException: Text '24:00:00 000000000 AM' could not be parsed, unparsed text found at index 19

False positives:

Time 60 with format mm should be invalid
Time 90 with format mm should be invalid
Time -1 with format m should be invalid
Time 60 with format m should be invalid
Time 90 with format m should be invalid
Time 0505 with format m should be invalid
Time 123 with format m should be invalid
Time 111 with format m should be invalid
cquiroz commented 10 months ago

Thanks for the report. I guess the parsers needs some improvements. PRs are welcome