You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ba...@apache.org on 2005/09/22 11:34:45 UTC

svn commit: r290918 - /myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/date/HtmlInputDate.java

Author: baranda
Date: Thu Sep 22 02:34:40 2005
New Revision: 290918

URL: http://svn.apache.org/viewcvs?rev=290918&view=rev
Log:
Fixes MYFACES-601. Thanks to Marcel Urbanek

Modified:
    myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/date/HtmlInputDate.java

Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/date/HtmlInputDate.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/date/HtmlInputDate.java?rev=290918&r1=290917&r2=290918&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/date/HtmlInputDate.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/date/HtmlInputDate.java Thu Sep 22 02:34:40 2005
@@ -201,10 +201,17 @@
         }
 
         public Date parse() throws ParseException{
-            SimpleDateFormat fullFormat = new SimpleDateFormat( "dd MM yyyy HH mm ss" );
+            Calendar tempCalendar=Calendar.getInstance();
             if (timeZone != null)
-                fullFormat.setTimeZone(timeZone);
-            return fullFormat.parse(day+" "+month+" "+year+" "+hours+" "+minutes+" "+seconds);
+                   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();
         }
 
         private String formatedInt(String toFormat){