Index: source/i18n/dtitvfmt.cpp |
diff --git a/source/i18n/dtitvfmt.cpp b/source/i18n/dtitvfmt.cpp |
index e3a2c4ea6bb6870ac9ab979a64dfea8a3534376f..21377e111a0806cd7d1d9c21acae89bc10b2a4f1 100644 |
--- a/source/i18n/dtitvfmt.cpp |
+++ b/source/i18n/dtitvfmt.cpp |
@@ -1,5 +1,5 @@ |
/******************************************************************************* |
-* Copyright (C) 2008-2014, International Business Machines Corporation and |
+* Copyright (C) 2008-2015, International Business Machines Corporation and |
* others. All Rights Reserved. |
******************************************************************************* |
* |
@@ -117,7 +117,10 @@ DateIntervalFormat::DateIntervalFormat() |
fDateFormat(NULL), |
fFromCalendar(NULL), |
fToCalendar(NULL), |
- fDtpng(NULL) |
+ fLocale(Locale::getRoot()), |
+ fDatePattern(NULL), |
+ fTimePattern(NULL), |
+ fDateTimeFormat(NULL) |
{} |
@@ -127,7 +130,10 @@ DateIntervalFormat::DateIntervalFormat(const DateIntervalFormat& itvfmt) |
fDateFormat(NULL), |
fFromCalendar(NULL), |
fToCalendar(NULL), |
- fDtpng(NULL) { |
+ fLocale(itvfmt.fLocale), |
+ fDatePattern(NULL), |
+ fTimePattern(NULL), |
+ fDateTimeFormat(NULL) { |
*this = itvfmt; |
} |
@@ -139,7 +145,9 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) { |
delete fInfo; |
delete fFromCalendar; |
delete fToCalendar; |
- delete fDtpng; |
+ delete fDatePattern; |
+ delete fTimePattern; |
+ delete fDateTimeFormat; |
if ( itvfmt.fDateFormat ) { |
fDateFormat = (SimpleDateFormat*)itvfmt.fDateFormat->clone(); |
} else { |
@@ -165,9 +173,10 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) { |
for ( i = 0; i< DateIntervalInfo::kIPI_MAX_INDEX; ++i ) { |
fIntervalPatterns[i] = itvfmt.fIntervalPatterns[i]; |
} |
- if (itvfmt.fDtpng) { |
- fDtpng = itvfmt.fDtpng->clone(); |
- } |
+ fLocale = itvfmt.fLocale; |
+ fDatePattern = (itvfmt.fDatePattern)? (UnicodeString*)itvfmt.fDatePattern->clone(): NULL; |
+ fTimePattern = (itvfmt.fTimePattern)? (UnicodeString*)itvfmt.fTimePattern->clone(): NULL; |
+ fDateTimeFormat = (itvfmt.fDateTimeFormat)? (UnicodeString*)itvfmt.fDateTimeFormat->clone(): NULL; |
} |
return *this; |
} |
@@ -178,7 +187,9 @@ DateIntervalFormat::~DateIntervalFormat() { |
delete fDateFormat; |
delete fFromCalendar; |
delete fToCalendar; |
- delete fDtpng; |
+ delete fDatePattern; |
+ delete fTimePattern; |
+ delete fDateTimeFormat; |
} |
@@ -201,6 +212,9 @@ DateIntervalFormat::operator==(const Format& other) const { |
equal = fFromCalendar->isEquivalentTo(*fmt->fFromCalendar) ; |
equal = fToCalendar->isEquivalentTo(*fmt->fToCalendar) ; |
equal = (fSkeleton == fmt->fSkeleton); |
+ equal = ((fDatePattern == NULL && fmt->fDatePattern == NULL) || (fDatePattern && fmt->fDatePattern && *fDatePattern == *fmt->fDatePattern)); |
+ equal = ((fTimePattern == NULL && fmt->fTimePattern == NULL) || (fTimePattern && fmt->fTimePattern && *fTimePattern == *fmt->fTimePattern)); |
+ equal = ((fDateTimeFormat == NULL && fmt->fDateTimeFormat == NULL) || (fDateTimeFormat && fmt->fDateTimeFormat && *fDateTimeFormat == *fmt->fDateTimeFormat)); |
#endif |
UBool res; |
res = ( this == fmt ) || |
@@ -214,8 +228,9 @@ DateIntervalFormat::operator==(const Format& other) const { |
fToCalendar && |
fToCalendar->isEquivalentTo(*fmt->fToCalendar) && |
fSkeleton == fmt->fSkeleton && |
- fDtpng && |
- (*fDtpng == *fmt->fDtpng) ); |
+ ((fDatePattern == NULL && fmt->fDatePattern == NULL) || (fDatePattern && fmt->fDatePattern && *fDatePattern == *fmt->fDatePattern)) && |
+ ((fTimePattern == NULL && fmt->fTimePattern == NULL) || (fTimePattern && fmt->fTimePattern && *fTimePattern == *fmt->fTimePattern)) && |
+ ((fDateTimeFormat == NULL && fmt->fDateTimeFormat == NULL) || (fDateTimeFormat && fmt->fDateTimeFormat && *fDateTimeFormat == *fmt->fDateTimeFormat)) && fLocale == fmt->fLocale); |
int8_t i; |
for (i = 0; i< DateIntervalInfo::kIPI_MAX_INDEX && res == TRUE; ++i ) { |
res = ( fIntervalPatterns[i].firstPart == |
@@ -314,17 +329,21 @@ DateIntervalFormat::format(Calendar& fromCalendar, |
} else if ( fromCalendar.get(UCAL_MINUTE, status) != |
toCalendar.get(UCAL_MINUTE, status) ) { |
field = UCAL_MINUTE; |
+ } else if ( fromCalendar.get(UCAL_SECOND, status) != |
+ toCalendar.get(UCAL_SECOND, status) ) { |
+ field = UCAL_SECOND; |
} |
if ( U_FAILURE(status) ) { |
return appendTo; |
} |
if ( field == UCAL_FIELD_COUNT ) { |
- /* ignore the second/millisecond etc. small fields' difference. |
+ /* ignore the millisecond etc. small fields' difference. |
* use single date when all the above are the same. |
*/ |
return fDateFormat->format(fromCalendar, appendTo, pos); |
} |
+ UBool fromToOnSameDay = (field==UCAL_AM_PM || field==UCAL_HOUR || field==UCAL_MINUTE || field==UCAL_SECOND); |
// following call should not set wrong status, |
// all the pass-in fields are valid till here |
@@ -341,7 +360,7 @@ DateIntervalFormat::format(Calendar& fromCalendar, |
*/ |
return fDateFormat->format(fromCalendar, appendTo, pos); |
} |
- return fallbackFormat(fromCalendar, toCalendar, appendTo, pos, status); |
+ return fallbackFormat(fromCalendar, toCalendar, fromToOnSameDay, appendTo, pos, status); |
} |
// If the first part in interval pattern is empty, |
// the 2nd part of it saves the full-pattern used in fall-back. |
@@ -351,7 +370,7 @@ DateIntervalFormat::format(Calendar& fromCalendar, |
UnicodeString originalPattern; |
fDateFormat->toPattern(originalPattern); |
fDateFormat->applyPattern(intervalPattern.secondPart); |
- appendTo = fallbackFormat(fromCalendar, toCalendar, appendTo, pos, status); |
+ appendTo = fallbackFormat(fromCalendar, toCalendar, fromToOnSameDay, appendTo, pos, status); |
fDateFormat->applyPattern(originalPattern); |
return appendTo; |
} |
@@ -372,7 +391,12 @@ DateIntervalFormat::format(Calendar& fromCalendar, |
fDateFormat->format(*firstCal, appendTo, pos); |
if ( !intervalPattern.secondPart.isEmpty() ) { |
fDateFormat->applyPattern(intervalPattern.secondPart); |
- fDateFormat->format(*secondCal, appendTo, pos); |
+ FieldPosition otherPos; |
+ otherPos.setField(pos.getField()); |
+ fDateFormat->format(*secondCal, appendTo, otherPos); |
+ if (pos.getEndIndex() == 0 && otherPos.getEndIndex() > 0) { |
+ pos = otherPos; |
+ } |
} |
fDateFormat->applyPattern(originalPattern); |
return appendTo; |
@@ -403,6 +427,15 @@ DateIntervalFormat::setDateIntervalInfo(const DateIntervalInfo& newItvPattern, |
UErrorCode& status) { |
delete fInfo; |
fInfo = new DateIntervalInfo(newItvPattern); |
+ |
+ // Delete patterns that get reset by initializePattern |
+ delete fDatePattern; |
+ fDatePattern = NULL; |
+ delete fTimePattern; |
+ fTimePattern = NULL; |
+ delete fDateTimeFormat; |
+ fDateTimeFormat = NULL; |
+ |
if ( fDateFormat ) { |
initializePattern(status); |
} |
@@ -427,10 +460,10 @@ DateIntervalFormat::adoptTimeZone(TimeZone* zone) |
// work clones of that calendar (and should not also be given ownership of the |
// adopted TimeZone). |
if (fFromCalendar) { |
- fFromCalendar->setTimeZone(*zone); |
+ fFromCalendar->setTimeZone(*zone); |
} |
if (fToCalendar) { |
- fToCalendar->setTimeZone(*zone); |
+ fToCalendar->setTimeZone(*zone); |
} |
} |
@@ -443,10 +476,10 @@ DateIntervalFormat::setTimeZone(const TimeZone& zone) |
// The fDateFormat has the master calendar for the DateIntervalFormat; |
// fFromCalendar and fToCalendar are internal work clones of that calendar. |
if (fFromCalendar) { |
- fFromCalendar->setTimeZone(zone); |
+ fFromCalendar->setTimeZone(zone); |
} |
if (fToCalendar) { |
- fToCalendar->setTimeZone(zone); |
+ fToCalendar->setTimeZone(zone); |
} |
} |
@@ -468,27 +501,29 @@ DateIntervalFormat::DateIntervalFormat(const Locale& locale, |
fDateFormat(NULL), |
fFromCalendar(NULL), |
fToCalendar(NULL), |
- fDtpng(NULL) |
+ fLocale(locale), |
+ fDatePattern(NULL), |
+ fTimePattern(NULL), |
+ fDateTimeFormat(NULL) |
{ |
if ( U_FAILURE(status) ) { |
delete dtItvInfo; |
return; |
} |
- fDtpng = DateTimePatternGenerator::createInstance(locale, status); |
- SimpleDateFormat* dtfmt = createSDFPatternInstance(*skeleton, locale, |
- fDtpng, status); |
+ SimpleDateFormat* dtfmt = |
+ static_cast<SimpleDateFormat *>( |
+ DateFormat::createInstanceForSkeleton( |
+ *skeleton, locale, status)); |
if ( U_FAILURE(status) ) { |
delete dtItvInfo; |
- delete fDtpng; |
delete dtfmt; |
return; |
} |
- if ( dtfmt == NULL || dtItvInfo == NULL || fDtpng == NULL ) { |
+ if ( dtfmt == NULL || dtItvInfo == NULL) { |
status = U_MEMORY_ALLOCATION_ERROR; |
// safe to delete NULL |
delete dtfmt; |
delete dtItvInfo; |
- delete fDtpng; |
return; |
} |
if ( skeleton ) { |
@@ -506,30 +541,6 @@ DateIntervalFormat::DateIntervalFormat(const Locale& locale, |
initializePattern(status); |
} |
- |
-SimpleDateFormat* U_EXPORT2 |
-DateIntervalFormat::createSDFPatternInstance(const UnicodeString& skeleton, |
- const Locale& locale, |
- DateTimePatternGenerator* dtpng, |
- UErrorCode& status) |
-{ |
- if ( U_FAILURE(status) ) { |
- return NULL; |
- } |
- |
- const UnicodeString pattern = dtpng->getBestPattern(skeleton, status); |
- if ( U_FAILURE(status) ) { |
- return NULL; |
- } |
- SimpleDateFormat* dtfmt = new SimpleDateFormat(pattern, locale, status); |
- if ( U_FAILURE(status) ) { |
- delete dtfmt; |
- return NULL; |
- } |
- return dtfmt; |
-} |
- |
- |
DateIntervalFormat* U_EXPORT2 |
DateIntervalFormat::create(const Locale& locale, |
DateIntervalInfo* dtitvinf, |
@@ -603,7 +614,8 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { |
#endif |
// fSkeleton is already set by createDateIntervalInstance() |
// or by createInstance(UnicodeString skeleton, .... ) |
- fSkeleton = fDtpng->getSkeleton(fullPattern, status); |
+ fSkeleton = DateTimePatternGenerator::staticGetSkeleton( |
+ fullPattern, status); |
if ( U_FAILURE(status) ) { |
return; |
} |
@@ -647,10 +659,39 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { |
PRINTMESG(mesg) |
#endif |
+ // move this up here since we need it for fallbacks |
+ if ( timeSkeleton.length() > 0 && dateSkeleton.length() > 0 ) { |
+ // Need the Date/Time pattern for concatenation of the date |
+ // with the time interval. |
+ // The date/time pattern ( such as {0} {1} ) is saved in |
+ // calendar, that is why need to get the CalendarData here. |
+ CalendarData* calData = new CalendarData(locale, NULL, status); |
+ if ( U_FAILURE(status) ) { |
+ delete calData; |
+ return; |
+ } |
+ if ( calData == NULL ) { |
+ status = U_MEMORY_ALLOCATION_ERROR; |
+ return; |
+ } |
+ |
+ const UResourceBundle* dateTimePatternsRes = calData->getByKey( |
+ gDateTimePatternsTag, status); |
+ int32_t dateTimeFormatLength; |
+ const UChar* dateTimeFormat = ures_getStringByIndex( |
+ dateTimePatternsRes, |
+ (int32_t)DateFormat::kDateTime, |
+ &dateTimeFormatLength, &status); |
+ if ( U_SUCCESS(status) && dateTimeFormatLength >= 3 ) { |
+ fDateTimeFormat = new UnicodeString(dateTimeFormat, dateTimeFormatLength); |
+ } |
+ delete calData; |
+ } |
UBool found = setSeparateDateTimePtn(normalizedDateSkeleton, |
normalizedTimeSkeleton); |
+ // for skeletons with seconds, found is false and we enter this block |
if ( found == false ) { |
// use fallback |
// TODO: if user asks "m"(minute), but "d"(day) differ |
@@ -658,7 +699,8 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { |
if ( dateSkeleton.length() == 0 ) { |
// prefix with yMd |
timeSkeleton.insert(0, gDateFormatSkeleton[DateFormat::kShort], -1); |
- UnicodeString pattern = fDtpng->getBestPattern(timeSkeleton, status); |
+ UnicodeString pattern = DateFormat::getBestPattern( |
+ locale, timeSkeleton, status); |
if ( U_FAILURE(status) ) { |
return; |
} |
@@ -683,7 +725,8 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { |
} else if ( dateSkeleton.length() == 0 ) { |
// prefix with yMd |
timeSkeleton.insert(0, gDateFormatSkeleton[DateFormat::kShort], -1); |
- UnicodeString pattern = fDtpng->getBestPattern(timeSkeleton, status); |
+ UnicodeString pattern = DateFormat::getBestPattern( |
+ locale, timeSkeleton, status); |
if ( U_FAILURE(status) ) { |
return; |
} |
@@ -727,42 +770,18 @@ DateIntervalFormat::initializePattern(UErrorCode& status) { |
* 2) otherwise, present the date followed by the |
* range expression for the time. |
*/ |
- // Need the Date/Time pattern for concatnation the date with |
- // the time interval. |
- // The date/time pattern ( such as {0} {1} ) is saved in |
- // calendar, that is why need to get the CalendarData here. |
- CalendarData* calData = new CalendarData(locale, NULL, status); |
- |
- if ( U_FAILURE(status) ) { |
- delete calData; |
- return; |
- } |
- if ( calData == NULL ) { |
- status = U_MEMORY_ALLOCATION_ERROR; |
- return; |
- } |
- |
- const UResourceBundle* dateTimePatternsRes = calData->getByKey( |
- gDateTimePatternsTag, status); |
- int32_t dateTimeFormatLength; |
- const UChar* dateTimeFormat = ures_getStringByIndex( |
- dateTimePatternsRes, |
- (int32_t)DateFormat::kDateTime, |
- &dateTimeFormatLength, &status); |
- if ( U_FAILURE(status) ) { |
+ if ( fDateTimeFormat == 0 ) { |
+ // earlier failure getting dateTimeFormat |
return; |
} |
- UnicodeString datePattern = fDtpng->getBestPattern(dateSkeleton, status); |
+ UnicodeString datePattern = DateFormat::getBestPattern( |
+ locale, dateSkeleton, status); |
- concatSingleDate2TimeInterval(dateTimeFormat, dateTimeFormatLength, |
- datePattern, UCAL_AM_PM, status); |
- concatSingleDate2TimeInterval(dateTimeFormat, dateTimeFormatLength, |
- datePattern, UCAL_HOUR, status); |
- concatSingleDate2TimeInterval(dateTimeFormat, dateTimeFormatLength, |
- datePattern, UCAL_MINUTE, status); |
- delete calData; |
+ concatSingleDate2TimeInterval(*fDateTimeFormat, datePattern, UCAL_AM_PM, status); |
+ concatSingleDate2TimeInterval(*fDateTimeFormat, datePattern, UCAL_HOUR, status); |
+ concatSingleDate2TimeInterval(*fDateTimeFormat, datePattern, UCAL_MINUTE, status); |
} |
} |
@@ -977,11 +996,27 @@ DateIntervalFormat::setSeparateDateTimePtn( |
return false; |
} |
+ // Set patterns for fallback use, need to do this |
+ // before returning if differenceInfo == -1 |
+ UErrorCode status; |
+ if ( dateSkeleton.length() != 0) { |
+ status = U_ZERO_ERROR; |
+ fDatePattern = new UnicodeString(DateFormat::getBestPattern( |
+ fLocale, dateSkeleton, status)); |
+ } |
+ if ( timeSkeleton.length() != 0) { |
+ status = U_ZERO_ERROR; |
+ fTimePattern = new UnicodeString(DateFormat::getBestPattern( |
+ fLocale, timeSkeleton, status)); |
+ } |
+ |
// difference: |
// 0 means the best matched skeleton is the same as input skeleton |
// 1 means the fields are the same, but field width are different |
// 2 means the only difference between fields are v/z, |
// -1 means there are other fields difference |
+ // (this will happen, for instance, if the supplied skeleton has seconds, |
+ // but no skeletons in the intervalFormats data do) |
if ( differenceInfo == -1 ) { |
// skeleton has different fields, not only v/z difference |
return false; |
@@ -1021,7 +1056,8 @@ DateIntervalFormat::setFallbackPattern(UCalendarDateFields field, |
if ( U_FAILURE(status) ) { |
return; |
} |
- UnicodeString pattern = fDtpng->getBestPattern(skeleton, status); |
+ UnicodeString pattern = DateFormat::getBestPattern( |
+ fLocale, skeleton, status); |
if ( U_FAILURE(status) ) { |
return; |
} |
@@ -1275,33 +1311,95 @@ DateIntervalFormat::splitPatternInto2Part(const UnicodeString& intervalPattern) |
return (i - count); |
} |
+static const UChar bracketedZero[] = {0x7B,0x30,0x7D}; |
+static const UChar bracketedOne[] = {0x7B,0x31,0x7D}; |
+void |
+DateIntervalFormat::adjustPosition(UnicodeString& combiningPattern, // has {0} and {1} in it |
+ UnicodeString& pat0, FieldPosition& pos0, // pattern and pos corresponding to {0} |
+ UnicodeString& pat1, FieldPosition& pos1, // pattern and pos corresponding to {1} |
+ FieldPosition& posResult) { |
+ int32_t index0 = combiningPattern.indexOf(bracketedZero, 3, 0); |
+ int32_t index1 = combiningPattern.indexOf(bracketedOne, 3, 0); |
+ if (index0 < 0 || index1 < 0) { |
+ return; |
+ } |
+ int32_t placeholderLen = 3; // length of "{0}" or "{1}" |
+ if (index0 < index1) { |
+ if (pos0.getEndIndex() > 0) { |
+ posResult.setBeginIndex(pos0.getBeginIndex() + index0); |
+ posResult.setEndIndex(pos0.getEndIndex() + index0); |
+ } else if (pos1.getEndIndex() > 0) { |
+ // here index1 >= 3 |
+ index1 += pat0.length() - placeholderLen; // adjust for pat0 replacing {0} |
+ posResult.setBeginIndex(pos1.getBeginIndex() + index1); |
+ posResult.setEndIndex(pos1.getEndIndex() + index1); |
+ } |
+ } else { |
+ if (pos1.getEndIndex() > 0) { |
+ posResult.setBeginIndex(pos1.getBeginIndex() + index1); |
+ posResult.setEndIndex(pos1.getEndIndex() + index1); |
+ } else if (pos0.getEndIndex() > 0) { |
+ // here index0 >= 3 |
+ index0 += pat1.length() - placeholderLen; // adjust for pat1 replacing {1} |
+ posResult.setBeginIndex(pos0.getBeginIndex() + index0); |
+ posResult.setEndIndex(pos0.getEndIndex() + index0); |
+ } |
+ } |
+} |
UnicodeString& |
DateIntervalFormat::fallbackFormat(Calendar& fromCalendar, |
Calendar& toCalendar, |
+ UBool fromToOnSameDay, // new |
UnicodeString& appendTo, |
FieldPosition& pos, |
UErrorCode& status) const { |
if ( U_FAILURE(status) ) { |
return appendTo; |
} |
+ UnicodeString fullPattern; // for saving the pattern in fDateFormat |
+ UBool formatDatePlusTimeRange = (fromToOnSameDay && fDatePattern && fTimePattern); |
// the fall back |
// no need delete earlierDate and laterDate since they are adopted |
+ if (formatDatePlusTimeRange) { |
+ fDateFormat->toPattern(fullPattern); // save current pattern, restore later |
+ fDateFormat->applyPattern(*fTimePattern); |
+ } |
+ FieldPosition otherPos; |
+ otherPos.setField(pos.getField()); |
UnicodeString* earlierDate = new UnicodeString(); |
- *earlierDate = fDateFormat->format(fromCalendar, *earlierDate, pos); |
+ fDateFormat->format(fromCalendar, *earlierDate, pos); |
UnicodeString* laterDate = new UnicodeString(); |
- *laterDate = fDateFormat->format(toCalendar, *laterDate, pos); |
+ fDateFormat->format(toCalendar, *laterDate, otherPos); |
UnicodeString fallbackPattern; |
fInfo->getFallbackIntervalPattern(fallbackPattern); |
+ adjustPosition(fallbackPattern, *earlierDate, pos, *laterDate, otherPos, pos); |
Formattable fmtArray[2]; |
fmtArray[0].adoptString(earlierDate); |
fmtArray[1].adoptString(laterDate); |
- UnicodeString fallback; |
- MessageFormat::format(fallbackPattern, fmtArray, 2, fallback, status); |
+ UnicodeString fallbackRange; |
+ MessageFormat::format(fallbackPattern, fmtArray, 2, fallbackRange, status); |
+ if ( U_SUCCESS(status) && formatDatePlusTimeRange ) { |
+ // fallbackRange has just the time range, need to format the date part and combine that |
+ fDateFormat->applyPattern(*fDatePattern); |
+ UnicodeString* datePortion = new UnicodeString(); |
+ otherPos.setBeginIndex(0); |
+ otherPos.setEndIndex(0); |
+ fDateFormat->format(fromCalendar, *datePortion, otherPos); |
+ adjustPosition(*fDateTimeFormat, fallbackRange, pos, *datePortion, otherPos, pos); |
+ fmtArray[0].setString(fallbackRange); // {0} is time range |
+ fmtArray[1].adoptString(datePortion); // {1} is single date portion |
+ fallbackRange.remove(); |
+ MessageFormat::format(*fDateTimeFormat, fmtArray, 2, fallbackRange, status); |
+ } |
if ( U_SUCCESS(status) ) { |
- appendTo.append(fallback); |
+ appendTo.append(fallbackRange); |
+ } |
+ if (formatDatePlusTimeRange) { |
+ // restore full pattern |
+ fDateFormat->applyPattern(fullPattern); |
} |
return appendTo; |
} |
@@ -1431,8 +1529,7 @@ DateIntervalFormat::adjustFieldWidth(const UnicodeString& inputSkeleton, |
void |
-DateIntervalFormat::concatSingleDate2TimeInterval(const UChar* format, |
- int32_t formatLen, |
+DateIntervalFormat::concatSingleDate2TimeInterval(UnicodeString& format, |
const UnicodeString& datePattern, |
UCalendarDateFields field, |
UErrorCode& status) { |
@@ -1452,8 +1549,7 @@ DateIntervalFormat::concatSingleDate2TimeInterval(const UChar* format, |
fmtArray[0].adoptString(timeIntervalPattern); |
fmtArray[1].adoptString(dateStr); |
UnicodeString combinedPattern; |
- MessageFormat::format(UnicodeString(TRUE, format, formatLen), |
- fmtArray, 2, combinedPattern, status); |
+ MessageFormat::format(format, fmtArray, 2, combinedPattern, status); |
if ( U_FAILURE(status) ) { |
return; |
} |