[richfaces-issues] [JBoss JIRA] Commented: (RF-8136) Richfaces.Calendar.parseDate using pattern "yyMMdd" is incompatible with java.text.SimpleDateFormat

Francisco Jose Peredo Noguez (JIRA) jira-events at lists.jboss.org
Thu Nov 12 16:33:05 EST 2009


    [ https://jira.jboss.org/jira/browse/RF-8136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12494400#action_12494400 ] 

Francisco Jose Peredo Noguez commented on RF-8136:
--------------------------------------------------

The worst thing about this bug, is that this behavior is not documented anywhere, there no logical reason to think that "60" should be 2060 and "70" should be 1970, if by some reason someone needs this strange behavior it should be configurable by an attribute in the rich:calendar (and by default it should be compatible with the behavior of java.text.SimpleDateFormat class)

> Richfaces.Calendar.parseDate using pattern "yyMMdd" is incompatible with java.text.SimpleDateFormat
> ---------------------------------------------------------------------------------------------------
>
>                 Key: RF-8136
>                 URL: https://jira.jboss.org/jira/browse/RF-8136
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.3.1
>            Reporter: Francisco Jose Peredo Noguez
>
> I have a rich calendar configured with the pattern "yyMMdd"
> If the user writes 600210 and the user clicks the little calendar button to show the popup, he can see that the date has been translated to "February 10 of 2060" but if he writes 700210 it is translated in to "February 10 of 1970". That is not consistent  the behavior of  java.text.SimpleDateFormat.
> The problem is at the file 3.3.1.GA\ui\calendar\src\main\resources\org\richfaces\renderkit\html\scripts\calendar.js (line 394 of the file):
> At the function Richfaces.Calendar.parseDate = function(dateString, pattern, monthNames, monthNamesShort) method:
> var yy = parseInt(match[y],10); if (isNaN(yy)) return null; else if (yy<70) yy+=2000; else if (yy<100) yy+=1900;
> That code translates the year in 600210  to 2060 when it should translate it to 1960 (to be consistent with java.text.SimpleDateFormat behavior.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list