Bug 888949 - Return hours in 0-23 range for time input types. r=mounir
authorWes Johnston <wjohnston@mozilla.com>
Tue, 02 Jul 2013 09:42:20 -0700
changeset 137169 23ce4eab8fb1ca49fdbb3e5d450ecfdd5a1ab770
parent 137168 ecdfb39891a77bfee56934afbc7bd2d91f8bb010
child 137170 8080d41c7c084d6a0266e20b17fb1b6a4c7902eb
push id1822
push userryanvm@gmail.com
push dateTue, 02 Jul 2013 19:17:36 +0000
treeherderfx-team@7469440b076b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs888949
milestone25.0a1
Bug 888949 - Return hours in 0-23 range for time input types. r=mounir
mobile/android/base/PromptInput.java
--- a/mobile/android/base/PromptInput.java
+++ b/mobile/android/base/PromptInput.java
@@ -176,24 +176,24 @@ class PromptInput {
                 mView = (View)input;
             } else if (mType.equals("time")) {
                 TimePicker input = new TimePicker(context);
                 input.setIs24HourView(DateFormat.is24HourFormat(context));
 
                 GregorianCalendar calendar = new GregorianCalendar();
                 if (!TextUtils.isEmpty(mValue)) {
                     try {
-                        calendar.setTime(new SimpleDateFormat("kk:mm").parse(mValue));
+                        calendar.setTime(new SimpleDateFormat("HH:mm").parse(mValue));
                     } catch (Exception e) { }
                 }
                 input.setCurrentHour(calendar.get(GregorianCalendar.HOUR_OF_DAY));
                 input.setCurrentMinute(calendar.get(GregorianCalendar.MINUTE));
                 mView = (View)input;
             } else if (mType.equals("datetime-local") || mType.equals("datetime")) {
-                DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd kk:mm", mValue,
+                DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd HH:mm", mValue,
                                                           DateTimePicker.PickersState.DATETIME);
                 input.toggleCalendar(true);
                 mView = (View)input;
             } else if (mType.equals("month")) {
                 DateTimePicker input = new DateTimePicker(context, "yyyy-MM", mValue,
                                                           DateTimePicker.PickersState.MONTH);
                 mView = (View)input;
             }
@@ -211,31 +211,31 @@ class PromptInput {
                 DatePicker dp = (DatePicker)mView;
                 GregorianCalendar calendar =
                     new GregorianCalendar(dp.getYear(),dp.getMonth(),dp.getDayOfMonth());
                 return formatDateString("yyyy-MM-dd",calendar);
             } else if (mType.equals("time")) {
                 TimePicker tp = (TimePicker)mView;
                 GregorianCalendar calendar =
                     new GregorianCalendar(0,0,0,tp.getCurrentHour(),tp.getCurrentMinute());
-                return formatDateString("kk:mm",calendar);
+                return formatDateString("HH:mm",calendar);
             } else {
                 DateTimePicker dp = (DateTimePicker)mView;
                 GregorianCalendar calendar = new GregorianCalendar();
                 calendar.setTimeInMillis(dp.getTimeInMillis());
                 if (mType.equals("date")) {
                     return formatDateString("yyyy-MM-dd",calendar);
                 } else if (mType.equals("week")) {
                     return formatDateString("yyyy-'W'ww",calendar);
                 } else if (mType.equals("datetime-local")) {
-                    return formatDateString("yyyy-MM-dd kk:mm",calendar);
+                    return formatDateString("yyyy-MM-dd HH:mm",calendar);
                 } else if (mType.equals("datetime")) {
                     calendar.set(GregorianCalendar.ZONE_OFFSET,0);
                     calendar.setTimeInMillis(dp.getTimeInMillis());
-                    return formatDateString("yyyy-MM-dd kk:mm",calendar);
+                    return formatDateString("yyyy-MM-dd HH:mm",calendar);
                 } else if (mType.equals("month")) {
                     return formatDateString("yyyy-MM",calendar);
                 }
             }
             return super.getValue();
         }
     }