DateTimeFormat: set the locale to the pattern generator.
Unfortunately this isn't enough to fix the bug shown by the test just added.
This commit is contained in:
parent
980b1bd045
commit
bb2a5b4db5
@ -48,7 +48,8 @@ BDateTimeFormat::SetDateTimeFormat(BDateFormatStyle dateStyle,
|
|||||||
BTimeFormatStyle timeStyle, int32 elements) {
|
BTimeFormatStyle timeStyle, int32 elements) {
|
||||||
UErrorCode error = U_ZERO_ERROR;
|
UErrorCode error = U_ZERO_ERROR;
|
||||||
DateTimePatternGenerator* generator
|
DateTimePatternGenerator* generator
|
||||||
= DateTimePatternGenerator::createInstance(error);
|
= DateTimePatternGenerator::createInstance(
|
||||||
|
*BLanguage::Private(&fLanguage).ICULocale(), error);
|
||||||
|
|
||||||
BString skeleton;
|
BString skeleton;
|
||||||
if (elements & B_DATE_ELEMENT_YEAR)
|
if (elements & B_DATE_ELEMENT_YEAR)
|
||||||
@ -63,9 +64,9 @@ BDateTimeFormat::SetDateTimeFormat(BDateFormatStyle dateStyle,
|
|||||||
skeleton << "a";
|
skeleton << "a";
|
||||||
if (elements & B_DATE_ELEMENT_HOUR) {
|
if (elements & B_DATE_ELEMENT_HOUR) {
|
||||||
if (fConventions.Use24HourClock())
|
if (fConventions.Use24HourClock())
|
||||||
skeleton << "HH";
|
skeleton << "k";
|
||||||
else
|
else
|
||||||
skeleton << "KK";
|
skeleton << "K";
|
||||||
}
|
}
|
||||||
if (elements & B_DATE_ELEMENT_MINUTE)
|
if (elements & B_DATE_ELEMENT_MINUTE)
|
||||||
skeleton << "mm";
|
skeleton << "mm";
|
||||||
@ -80,6 +81,7 @@ BDateTimeFormat::SetDateTimeFormat(BDateFormatStyle dateStyle,
|
|||||||
BString buffer;
|
BString buffer;
|
||||||
BStringByteSink stringConverter(&buffer);
|
BStringByteSink stringConverter(&buffer);
|
||||||
pattern.toUTF8(stringConverter);
|
pattern.toUTF8(stringConverter);
|
||||||
|
|
||||||
fConventions.SetExplicitDateTimeFormat(dateStyle, timeStyle, buffer);
|
fConventions.SetExplicitDateTimeFormat(dateStyle, timeStyle, buffer);
|
||||||
|
|
||||||
delete generator;
|
delete generator;
|
||||||
|
@ -234,8 +234,6 @@ BTimeFormat::Parse(BString source, BTimeFormatStyle style, BTime& output)
|
|||||||
UDate date = timeFormatter->parse(UnicodeString::fromUTF8(source.String()),
|
UDate date = timeFormatter->parse(UnicodeString::fromUTF8(source.String()),
|
||||||
p);
|
p);
|
||||||
|
|
||||||
printf("T %f\n", date);
|
|
||||||
|
|
||||||
output.SetTime(0, 0, 0);
|
output.SetTime(0, 0, 0);
|
||||||
output.AddMilliseconds(date);
|
output.AddMilliseconds(date);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user