Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Parsing 2 or 4 digit years #218
A common use case for input of dates is to allow either 2 digit or 4 digit input. A two digit input is offset by the base but if 4 digits are supplied the base is ignored.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
So, I don't see the use case for enabling yyyy to parse a 2 digit year.
What then is useful for inputting and parsing locale specific dates. The use case is for a multi-locale/chronology calendar user interface not specific to ISO that needs to use the locale specific formats.
The CLDR/LDML describes the theory, which basically involves a hand written customized parser that applies lots of rules to guess the user's intent as best as possible. Not terribly appealing. That is why I say that the localized form is really for output, not input.
Any UI should be a date picker, with separate year, month and day fields in some shape or form.
A separately useful feature is something like this
I've had to work this out before by parsing the patterns from SimpleDateFormat.