Bug 1147770 - Modify datapicker to support literal 'T' and 'Z' when choosing datetime. r=wesj
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Thu, 30 Apr 2015 19:29:00 -0400
changeset 274291 e8723577fd63c7c4e54cf557c96544c4e8b7adde
parent 274290 d606bc66663f0dc6564cab9812d075272fd72c3a
child 274292 9d96f30f4f410fb164e5c2f909bd1e485b713665
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs1147770
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1147770 - Modify datapicker to support literal 'T' and 'Z' when choosing datetime. r=wesj
mobile/android/base/prompts/PromptInput.java
--- a/mobile/android/base/prompts/PromptInput.java
+++ b/mobile/android/base/prompts/PromptInput.java
@@ -211,17 +211,17 @@ public class PromptInput {
                     try {
                         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 HH:mm", mValue.replace("T"," "),
+                DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd HH:mm", mValue.replace("T"," ").replace("Z", ""),
                                                           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;
             }
@@ -254,17 +254,17 @@ public class PromptInput {
                     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'T'HH:mm",calendar);
                 } else if (mType.equals("datetime")) {
                     calendar.set(GregorianCalendar.ZONE_OFFSET,0);
                     calendar.setTimeInMillis(dp.getTimeInMillis());
-                    return formatDateString("yyyy-MM-dd HH:mm",calendar);
+                    return formatDateString("yyyy-MM-dd'T'HH:mm'Z'",calendar);
                 } else if (mType.equals("month")) {
                     return formatDateString("yyyy-MM",calendar);
                 }
             }
             return super.getValue();
         }
     }