Kotlin / kotlinx-datetime

KotlinX multiplatform date/time library
Apache License 2.0
2.39k stars 99 forks source link

Potential improvements and input preservation in parsing and formatting error messages #361

Closed qwwdfsad closed 6 months ago

qwwdfsad commented 7 months ago

I've set the experiment "I have a system with externally-supplied input that I'm parsing" in order to see how debuggable the end system is.

Here are a few potential improvements that can be made:

1) Inconsistent hour and the AM/PM marker correctly shows an unexpected component, but it would be nice to see the full input to understand the source of the problem.

E.g. for Inconsistent hour and the AM/PM marker: hour is 23, but the AM/PM marker is AM 23 is nice, but for observability purposes, I would like to see the whole input.

2) Position X: Expected One of probably should be Position 0: Expected one of

3) The same as for 1 it goes for validation of components done in constructors: LocalDate, LocalDateTime, LocalTime, UtcOffset

dkhalanskyjb commented 7 months ago

Added a commit addressing this to https://github.com/Kotlin/kotlinx-datetime/pull/360