-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8, 9
-
generic
-
generic
FULL PRODUCT VERSION :
ADDITIONAL OS VERSION INFORMATION :
Ubuntu Linux 15.10
A DESCRIPTION OF THE PROBLEM :
I've found unexpected behaviour while parsing dates from string.
From my previous experiense
new SimpleDateFormat("MMM yyyy", Locale.ENGLISH)).parse(DATE_AS_TEXT));
Will work for next strings:
- oct 2015
- Oct 2015
- OCT 2015
The same holds for pattern "MMMM yyyy"
- October 2015
- october 2015
- OCT 2015
BUT if I will use this patters to parse date via java.time API than I'will get parse exception in most cases.
YearMonth.parse(DATE_AS_TEXT, DateTimeFormatter.ofPattern("MMM yyyy").withLocale(Locale.ENGLISH)));
New API requires month name to be only in capitalized format Oct, Jun, Jul etc. Lower case names on upper case raise exception.
The same holds is for full month names.
If new time API interpreters minterpreteronth names differently it must be mentioned in documenation, otherwise new time API must parse month names as case insensetive mode.
Actually it will be much better if month names will be parsed as case insensetive text.
The point here is that usually we are parsing humman writted text. And humans not really strict about date formats, they can type month in upper and lower case as well as in capitalized form.
REPRODUCIBILITY :
This bug can be reproduced occasionally.
ADDITIONAL OS VERSION INFORMATION :
Ubuntu Linux 15.10
A DESCRIPTION OF THE PROBLEM :
I've found unexpected behaviour while parsing dates from string.
From my previous experiense
new SimpleDateFormat("MMM yyyy", Locale.ENGLISH)).parse(DATE_AS_TEXT));
Will work for next strings:
- oct 2015
- Oct 2015
- OCT 2015
The same holds for pattern "MMMM yyyy"
- October 2015
- october 2015
- OCT 2015
BUT if I will use this patters to parse date via java.time API than I'will get parse exception in most cases.
YearMonth.parse(DATE_AS_TEXT, DateTimeFormatter.ofPattern("MMM yyyy").withLocale(Locale.ENGLISH)));
New API requires month name to be only in capitalized format Oct, Jun, Jul etc. Lower case names on upper case raise exception.
The same holds is for full month names.
If new time API interpreters minterpreteronth names differently it must be mentioned in documenation, otherwise new time API must parse month names as case insensetive mode.
Actually it will be much better if month names will be parsed as case insensetive text.
The point here is that usually we are parsing humman writted text. And humans not really strict about date formats, they can type month in upper and lower case as well as in capitalized form.
REPRODUCIBILITY :
This bug can be reproduced occasionally.