[ https://issues.apache.org/jira/browse/ADFFACES-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481329 ]
Yee-Wah Lee commented on ADFFACES-410: -------------------------------------- It seems that: 1) For formatting from Date to String, we want to use 4 digit year format for shortish style, so the code above should be executed. 2) For parsing from String -> Date, we want to use 2 digit year format. From the SimpleDateFormat javadoc about parsing the year: For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of "MM/dd/yy" and a SimpleDateFormat instance created on Jan 1, 1997, the string "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits, as defined by Character.isDigit(char), will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn't all digits (for example, "-1"), is interpreted literally. So "01/02/3" or "01/02/003" are parsed, using the same pattern, as Jan 2, 3 AD. Likewise, "01/02/-3" is parsed as Jan 2, 4 BC. => Hence, '07' would be interpreted as 2007, and '2007' would be accepted as well. > DateTimeConverter does not use 2DigitYearStart() when parsing strings with > year less than 4-digit > ------------------------------------------------------------------------------------------------- > > Key: ADFFACES-410 > URL: https://issues.apache.org/jira/browse/ADFFACES-410 > Project: MyFaces ADF-Faces > Issue Type: Bug > Components: Components > Affects Versions: 2.0.0-incubating-core-SNAPSHOT > Reporter: Yee-Wah Lee > Priority: Minor > Fix For: 2.0.0-incubating-core-SNAPSHOT > > > 1. Create an inputText with an attached dateTimeConverter, and bind its value > to a backing bean. > <tr:inputText value="#{date.date1}" autoSubmit="true"> > <tr:convertDateTime/> > </tr:inputText> > <tr:outputText value="#{date.date1}"/> > > 2. When the page runs, enter a date like "1/1/07" and submit > 3. The outputText shows that the date submitted was "1st January 7 AD", not > the (more likely expected) 2007 A.D. This is despite the fact that the > DateTimeConverter uses 1950 as the default century for interpreting 2 digit > years. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.