[ https://issues.apache.org/jira/browse/ADFFACES-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481326 ]
Yee-Wah Lee commented on ADFFACES-410: -------------------------------------- I see the following code in the (server-side) DateTimeConverter and think it may be problematic. 1) The default style for dates is set to shortish, which forces the year pattern to be at least 4 digits (http://incubator.apache.org/adffaces/trinidad-api/apidocs/org/apache/myfaces/trinidad/convert/DateTimeConverter.html) New dateStyle shortish has been introduced. Shortish is identical to short but forces the year to be a full four digits. If dateStyle is not set, then dateStyle defaults to shortish. 2) Accordingly, the converter sets the pattern on its DateFormat to use at least 4 digits, if 'y' appears at all. The method is _get4YearFormat() 3) Now, the Javadoc states this for SimpleDateFormat (http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html) For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. > 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.