-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
Process: horse.haynet.debug, PID: 10367
java.lang.IllegalArgumentException: At most one variable-length numeric field in a row is allowed, but got several: [year, hourOfAmPm]. Parsing is undefined: for example, with variable-length month number and variable-length day of month, '111' can be parsed as Jan 11th or Nov 1st.
at kotlinx.datetime.internal.format.parser.NumberSpanParserOperation.<init>(ParserOperation.kt:56)
at kotlinx.datetime.internal.format.parser.ParserKt.concat$simplify(Parser.kt:69)
at kotlinx.datetime.internal.format.parser.ParserKt.concat$simplify(Parser.kt:76)
at kotlinx.datetime.internal.format.parser.ParserKt.concat(Parser.kt:125)
at kotlinx.datetime.internal.format.ConcatenatedFormatStructure.parser(FormatStructure.kt:233)
at kotlinx.datetime.internal.format.CachedFormatStructure.<init>(FormatStructure.kt:248)
at kotlinx.datetime.format.AbstractDateTimeFormatBuilder.build(DateTimeFormatBuilder.kt:476)
at kotlinx.datetime.format.DateTimeComponents$Companion.Format(DateTimeComponents.kt:59)
Example formatter:
format(
format = DateTimeComponents.Format {
monthName(MonthNames.ENGLISH_ABBREVIATED)
chars(" ")
day(Padding.NONE)
chars(" ")
year(Padding.ZERO)
amPmHour(Padding.NONE)
minute();
amPmMarker("am", "pm")
},
AFAIK, this is incorrect, or the error is wrong at minimum? As there are two variable lengths, day of month
and amPmHour
(as they are padding none), but year
(should) expects 4 digits not 2-4.
Also in a formatting situation, I don't care about parsing, I'm formatting, so it would be really nice to skip the parser check when I'm only outputting. If parsing that date, 100% agree could potentially be wrong.
Metadata
Metadata
Assignees
Labels
No labels