You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Scott O'Bryan (Updated) (JIRA)" <de...@myfaces.apache.org> on 2012/02/22 01:46:48 UTC

[jira] [Updated] (TRINIDAD-1821) client-side DateFormat improperly parses year when format mask contains 3 or more 'y'

     [ https://issues.apache.org/jira/browse/TRINIDAD-1821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott O'Bryan updated TRINIDAD-1821:
------------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

I applied the patch to the trunk but not to the private branches.  Please reopen this if the patches to those prototype branches are still needed.
                
> client-side DateFormat improperly parses year when format mask contains 3 or more 'y'
> -------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1821
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1821
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>            Reporter: Cale Scholl
>            Assignee: Scott O'Bryan
>            Priority: Minor
>         Attachments: date_subparse_year_1.2.12.3.patch, date_subparse_year_2.0.0.3.1.patch, date_subparse_year_trunk.patch
>
>
> The following section of code was located in the _subparse function of trinidad-impl DateFormat.js and was ripped out:
>           else if (charCount == 4)
>           {
>             // Bug 2169562: For four-digit year formats, reject
>             // three-year entries.  Fair enough!
>             if (enteredChars == 3)
>               return false;
>             if (enteredChars <= 2)
>               year = _fix2DYear(year);
>           }
> If a 4-digit format mask is specified for the year, it means full year format, so any number is valid. Read the following:
> http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
> In particular:
> "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."

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira