[ http://issues.apache.org/jira/browse/MYFACES-601?page=all ]
     
Bruno Aranda closed MYFACES-601:
--------------------------------

    Fix Version: Nightly Build
     Resolution: Fixed

This should be fixed in the SVN (r290918) and available in the next nightly. 
Thanks Marcel!

> Bug in org.apache.myfaces.custom.date.HtmlInputDate (misinterprets 12:xx )
> --------------------------------------------------------------------------
>
>          Key: MYFACES-601
>          URL: http://issues.apache.org/jira/browse/MYFACES-601
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Reporter: Marcel Urbanek
>     Assignee: Bruno Aranda
>     Priority: Minor
>      Fix For: Nightly Build

>
> In method parse() the date is parsed as follows: 
> SimpleDateFormat fullFormat = new SimpleDateFormat( "dd MM yyyy HH mm ss" ); 
> if (timeZone != null) 
>         fullFormat.setTimeZone(timeZone); 
> return fullFormat.parse(day+" "+month+" "+year+" "+hours+" "+minutes+" 
> "+seconds); 
> This is normally no problem, but when the variable "hours" is "12", 
> SimpleDateFormat "misinterprets" this value and thinks it's 12 AM, but the 
> user normally intendet 12 PM (using a 24h clock). This can be solved by using 
> the following routine instead: 
>           
> Calendar tempCalendar=Calendar.getInstance(); 
> if (timeZone != null) 
>         tempCalendar.setTimeZone(timeZone); 
> tempCalendar.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day)); 
> tempCalendar.set(Calendar.MONTH,Integer.parseInt(month)-1); 
> tempCalendar.set(Calendar.YEAR,Integer.parseInt(year)); 
> tempCalendar.set(Calendar.HOUR_OF_DAY,Integer.parseInt(hours)); 
> tempCalendar.set(Calendar.MINUTE,Integer.parseInt(minutes)); 
> return tempCalendar.getTime(); 
> } 

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

Reply via email to