From bb2a5b4db534d19bab263382dc4bb53fa8816603 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 20 Oct 2014 17:24:50 +0200 Subject: [PATCH] DateTimeFormat: set the locale to the pattern generator. Unfortunately this isn't enough to fix the bug shown by the test just added. --- src/kits/locale/DateTimeFormat.cpp | 8 +++++--- src/kits/locale/TimeFormat.cpp | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kits/locale/DateTimeFormat.cpp b/src/kits/locale/DateTimeFormat.cpp index eb4bcea85d..0d037c6410 100644 --- a/src/kits/locale/DateTimeFormat.cpp +++ b/src/kits/locale/DateTimeFormat.cpp @@ -48,7 +48,8 @@ BDateTimeFormat::SetDateTimeFormat(BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle, int32 elements) { UErrorCode error = U_ZERO_ERROR; DateTimePatternGenerator* generator - = DateTimePatternGenerator::createInstance(error); + = DateTimePatternGenerator::createInstance( + *BLanguage::Private(&fLanguage).ICULocale(), error); BString skeleton; if (elements & B_DATE_ELEMENT_YEAR) @@ -63,9 +64,9 @@ BDateTimeFormat::SetDateTimeFormat(BDateFormatStyle dateStyle, skeleton << "a"; if (elements & B_DATE_ELEMENT_HOUR) { if (fConventions.Use24HourClock()) - skeleton << "HH"; + skeleton << "k"; else - skeleton << "KK"; + skeleton << "K"; } if (elements & B_DATE_ELEMENT_MINUTE) skeleton << "mm"; @@ -80,6 +81,7 @@ BDateTimeFormat::SetDateTimeFormat(BDateFormatStyle dateStyle, BString buffer; BStringByteSink stringConverter(&buffer); pattern.toUTF8(stringConverter); + fConventions.SetExplicitDateTimeFormat(dateStyle, timeStyle, buffer); delete generator; diff --git a/src/kits/locale/TimeFormat.cpp b/src/kits/locale/TimeFormat.cpp index 633f47bb95..63d3ae257e 100644 --- a/src/kits/locale/TimeFormat.cpp +++ b/src/kits/locale/TimeFormat.cpp @@ -234,8 +234,6 @@ BTimeFormat::Parse(BString source, BTimeFormatStyle style, BTime& output) UDate date = timeFormatter->parse(UnicodeString::fromUTF8(source.String()), p); - printf("T %f\n", date); - output.SetTime(0, 0, 0); output.AddMilliseconds(date);