@@ -35,13 +35,10 @@ using std::string;
3535
3636auto StringToEStyle (string style_string) -> icu::DateFormat::EStyle {
3737 if (style_string == " full" ) { return icu::DateFormat::kFull ;
38- }
39- if (style_string == " long" ) { return icu::DateFormat::kLong ;
40- }
41- if (style_string == " medium" ) { return icu::DateFormat::kMedium ;
42- }
43- if (style_string == " short" ) { return icu::DateFormat::kShort ;
44- }
38+ } else if (style_string == " long" ) { return icu::DateFormat::kLong ;
39+ } else if (style_string == " medium" ) { return icu::DateFormat::kMedium ;
40+ } else if (style_string == " short" ) { return icu::DateFormat::kShort ;
41+ }
4542 return icu::DateFormat::kNone ;
4643}
4744
@@ -224,7 +221,7 @@ auto TestDatetimeFmt(json_object *json_in) -> string {
224221 // Use ISO string form of the date/time.
225222 json_object *input_string_obj =
226223 json_object_object_get (json_in, " input_string" );
227- // Prefer ISO input as input .
224+ // Use ISO input in milliseconds if available .
228225 json_object *input_millis = json_object_object_get (json_in, " input_millis" );
229226
230227 UDate test_date_time;
@@ -233,26 +230,10 @@ auto TestDatetimeFmt(json_object *json_in) -> string {
233230
234231 string input_date_string = json_object_get_string (input_string_obj);
235232
236- // SimpleDateFormat can't parse options or timezone offset
237- // First, remove options starting with "["
238- std::size_t pos = input_date_string.find (" [" );
239- if (pos >= 0 ) {
240- input_date_string = input_date_string.substr (0 , pos);
241- }
242- // Now remove the explicit offset
243- pos = input_date_string.find (" +" );
244- if (pos >= 0 ) {
245- input_date_string = input_date_string.substr (0 , pos);
246- }
247- pos = input_date_string.rfind (" -" );
248- if (pos >= 10 ) {
249- // DOn't clip in the date fields
250- input_date_string = input_date_string.substr (0 , pos);
251- }
252233 UnicodeString date_ustring (input_date_string.c_str ());
253234
254- // TODO: handles the offset +/-
255- SimpleDateFormat iso_date_fmt (u" y-M-d'T'h :m:sZ" , und_locale, status);
235+ // Input string is in 24 hour time!
236+ SimpleDateFormat iso_date_fmt (u" y-M-d'T'H :m:sZ" , und_locale, status);
256237 if (U_FAILURE (status) != 0 ) {
257238 string error_name = u_errorName (status);
258239 string error_message =
0 commit comments