You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Steve Davis <st...@digitalevergreen.com> on 2002/02/08 17:06:10 UTC

[PATCH] BaseValueParser (Turbine-2) fix bug in TimeSelector parsing

Here is a patch to fix the parsing of a TimeSelector when
using the ampm flag.  Currently BaseValueParser generates
an IllegalArgumentException if you put in 12:xx pm using a
TimeSelector pulldown. Also anything that is input as 
12:xx am will actually get stored as 12:xx pm.  I thought 
I had submitted this patch sometime last year but it never 
got committed. Could someone commit this for me? 

Thanks,

Steven F. Davis
steve.davis@digitalevergreen.com
==========================================================================================

Index: BaseValueParser.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/BaseValueParser.java,v
retrieving revision 1.2
diff -u -r1.2 BaseValueParser.java
--- BaseValueParser.java	15 Nov 2001 23:11:55 -0000	1.2
+++ BaseValueParser.java	8 Feb 2002 15:49:59 -0000
@@ -1102,7 +1102,11 @@
                 // Convert from 12 to 24hr format if appropriate
                 if (ampm != null)
                 {
-                    if (Integer.parseInt(ampm) == Calendar.PM)
+                    if ( hour == 12 )
+                    {
+                        hour = (Integer.parseInt(ampm) == Calendar.PM) ? 12 : 0;
+                    }
+                    else if (Integer.parseInt(ampm) == Calendar.PM)
                     {
                         hour += 12;
                     }




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>