myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Aranda <brunoara...@gmail.com>
Subject Re: Small bug in org.apache.myfaces.custom.date.HtmlInputDate
Date Thu, 22 Sep 2005 07:41:03 GMT
Could you open a JIRA issue and submit your patch there? Thanks!

Bruno

2005/9/21, Marcel Urbanek <dt0a28@retail-sc.com>:
>
> Hi.
>
> 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();
> }
>
> Greets, Marcel Urbanek
>
>

Mime
View raw message