ICU-7007 availableFormats remapping of month types does not work

X-SVN-Rev: 27001
This commit is contained in:
Peter Edberg 2009-12-02 07:17:06 +00:00
parent c77ddd796e
commit 305743045f
3 changed files with 9 additions and 9 deletions

View File

@ -1018,8 +1018,8 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern,
// - "field" is the field from the found pattern.
//
// The adjusted field should consist of characters from the originally requested
// skeleton, except in the case of UDATPG_HOUR_FIELD, in which case it should consist
// of characters from the found pattern.
// skeleton, except in the case of UDATPG_HOUR_FIELD or UDATPG_MONTH_FIELD, in
// which case it should consist of characters from the found pattern.
//
// The length of the adjusted field (adjFieldLen) should match that in the originally
// requested skeleton, except that if there is a specified skeleton for the found pattern
@ -1041,7 +1041,7 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern,
adjFieldLen = field.length();
}
}
UChar c = (typeValue!= UDATPG_HOUR_FIELD)? reqField.charAt(0): field.charAt(0);
UChar c = (typeValue!= UDATPG_HOUR_FIELD && typeValue!= UDATPG_MONTH_FIELD)? reqField.charAt(0): field.charAt(0);
field.remove();
for (int32_t i=adjFieldLen; i>0; --i) {
field+=c;

View File

@ -722,7 +722,7 @@ void DateIntervalFormatTest::testFormat() {
"zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
"zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "11\\u6708", // (fixed expected result per ticket:6626:)
"zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "\\u5341\\u4E00\\u6708", // (fixed expected result per ticket:6626: and others)
"zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u20132007\\u5e7411\\u670820\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800",

View File

@ -122,18 +122,18 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
UnicodeString("58:59"),
UnicodeString("Januar 1999"), // de 11: yyyyMMMM
UnicodeString("1.1999"), // fi: yM (fixed expected result per ticket:6626:)
UnicodeString("tammikuuta 1999"),
UnicodeString("1.1999"), // fi 0: yM (fixed expected result per ticket:6626:)
UnicodeString("tammi 1999"), // fi 1: yMMM
UnicodeString("13.1.1999"),
UnicodeString("13. tammikuuta 1999"),
UnicodeString("13. tammikuuta 1999"), // fi 3: yMMMd
UnicodeString("13.1."),
UnicodeString("13. tammikuuta"),
UnicodeString("13. tammikuuta"), // fi 5: MMMd
UnicodeString("1. nelj. 1999"),
UnicodeString("11.58 ip."), // fi 7: hhmm
UnicodeString("23.58"),
UnicodeString("23.58"), // fi 9: jjmm
UnicodeString("58.59"),
UnicodeString("tammikuuta 1999"), // fi 11: yyyyMMMM
UnicodeString("tammikuu 1999"), // fi 11: yyyyMMMM
UnicodeString("1999/1"), // ja 0: yM -> y/M
CharsToUnicodeString("1999\\u5E741\\u6708"), // ja 1: yMMM -> y\u5E74M\u6708