From adffaces-issues-return-1885-apmail-incubator-adffaces-issues-archive=incubator.apache.org@incubator.apache.org Thu Mar 15 21:30:30 2007 Return-Path: Delivered-To: apmail-incubator-adffaces-issues-archive@locus.apache.org Received: (qmail 15206 invoked from network); 15 Mar 2007 21:30:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Mar 2007 21:30:30 -0000 Received: (qmail 90556 invoked by uid 500); 15 Mar 2007 21:30:38 -0000 Delivered-To: apmail-incubator-adffaces-issues-archive@incubator.apache.org Received: (qmail 90535 invoked by uid 500); 15 Mar 2007 21:30:38 -0000 Mailing-List: contact adffaces-issues-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: adffaces-issues@incubator.apache.org Delivered-To: mailing list adffaces-issues@incubator.apache.org Received: (qmail 90526 invoked by uid 99); 15 Mar 2007 21:30:38 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 14:30:38 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 14:30:29 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9732271407B for ; Thu, 15 Mar 2007 14:30:09 -0700 (PDT) Message-ID: <28035683.1173994209615.JavaMail.jira@brutus> Date: Thu, 15 Mar 2007 14:30:09 -0700 (PDT) From: "Yee-Wah Lee (JIRA)" To: adffaces-issues@incubator.apache.org Subject: [jira] Commented: (ADFFACES-410) DateTimeConverter does not use 2DigitYearStart() when parsing strings with year less than 4-digit In-Reply-To: <7022882.1173993969440.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ 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. > > > > > > 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.