ICU-9984 For DTPG, Y in skeleton should produce Y in pattern

X-SVN-Rev: 33562
This commit is contained in:
Peter Edberg 2013-04-29 22:10:29 +00:00
parent dabb8350c7
commit 79b8f74642
2 changed files with 11 additions and 1 deletions

View File

@ -1091,7 +1091,7 @@ DateTimePatternGenerator::adjustFieldTypes(const UnicodeString& pattern,
}
}
UChar c = (typeValue!= UDATPG_HOUR_FIELD && typeValue!= UDATPG_MONTH_FIELD &&
typeValue!= UDATPG_WEEKDAY_FIELD && typeValue!= UDATPG_YEAR_FIELD)?
typeValue!= UDATPG_WEEKDAY_FIELD && (typeValue!= UDATPG_YEAR_FIELD || reqField.charAt(0)==CAP_Y))?
reqField.charAt(0): field.charAt(0);
field.remove();
for (int32_t i=adjFieldLen; i>0; --i) {

View File

@ -849,6 +849,16 @@ void IntlTestDateTimePatternGeneratorAPI::testOptions(/*char *par*/)
{ "be", "Hmm", "H.mm", UDATPG_MATCH_HOUR_FIELD_LENGTH },
{ "be", "HHmm", "HH.mm", UDATPG_MATCH_HOUR_FIELD_LENGTH },
{ "be", "hhmm", "hh.mm a", UDATPG_MATCH_HOUR_FIELD_LENGTH },
//
{ "en", "yyyy", "yyyy", UDATPG_MATCH_NO_OPTIONS },
{ "en", "YYYY", "YYYY", UDATPG_MATCH_NO_OPTIONS },
{ "en", "U", "y", UDATPG_MATCH_NO_OPTIONS },
{ "en@calendar=japanese", "yyyy", "y G", UDATPG_MATCH_NO_OPTIONS },
{ "en@calendar=japanese", "YYYY", "Y G", UDATPG_MATCH_NO_OPTIONS },
{ "en@calendar=japanese", "U", "y G", UDATPG_MATCH_NO_OPTIONS },
{ "en@calendar=chinese", "yyyy", "U", UDATPG_MATCH_NO_OPTIONS },
{ "en@calendar=chinese", "YYYY", "Y", UDATPG_MATCH_NO_OPTIONS },
{ "en@calendar=chinese", "U", "U", UDATPG_MATCH_NO_OPTIONS },
};
int count = sizeof(testData) / sizeof(testData[0]);