hlship / tapx

Extensions to Tapestry 5
http://tapestry.formos.com/projects/tapx/
29 stars 7 forks source link

Time picker portion always uses 24-hour format #7

Closed jochenberger closed 13 years ago

jochenberger commented 14 years ago

The hour selector in the popup always uses the default timeFormat of "24". I created a patch that chooses "12" or "24" depending on whether the format pattern contains a "%p". Unfortunately I'm new to git(hub) and I'm not sure how to go on now, but as the change is a one-liner I'll just write it down here:

From c575952f11c34940a5b382e46863189a69a061b1 Mon Sep 17 00:00:00 2001
From: Jochen Berger <fooberger@googlemail.com>
Date: Fri, 20 Aug 2010 13:26:57 +0200
Subject: [PATCH 1/2] use 12- or 24-hour time format depending on format pattern

---
 .../tapx/datefield/tapx-datefield.js               |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tapx-datefield/src/main/resources/com/howardlewisship/tapx/datefield/tapx-datefield.js b/tapx-datefield/src/main/resources/com/howardlewisship/tapx/datefield/tapx-datefield.js
index c81de65..168f610 100644
--- a/tapx-datefield/src/main/resources/com/howardlewisship/tapx/datefield/tapx-datefield.js
+++ b/tapx-datefield/src/main/resources/com/howardlewisship/tapx/datefield/tapx-datefield.js
@@ -6,6 +6,7 @@ Tapestry.Initializer.tapxDateField = function(spec)
         weekNumbers : false,
         showsTime : spec.time,
         ifFormat : spec.clientDateFormat,
+        timeFormat : spec.time && spec.clientDateFormat.match("%p") != null ? "12" : "24",
         cache : true
     });
 }
\ No newline at end of file
-- 
1.7.0.4
jochenberger commented 14 years ago

I'm beginning to get the hang of it. ;-): http://github.com/jochenberger/tapx/commit/9fca265aa3dcf235a488a92c7e63faa2faca0c38

hlship commented 13 years ago

Fixed by 7b77e28de0195adf0f2dc4006d7346014c49fa36