- if (U_FAILURE(*status)) {
- return -1;
- }
- UnicodeString res;
- if (!(result==NULL && resultCapacity==0)) {
- // NULL destination for pure preflighting: empty dummy string
- // otherwise, alias the destination buffer (copied from udat_format)
- res.setTo(result, 0, resultCapacity);
- }
- FieldPosition fp;
- if (position != 0) {
- fp.setField(position->field);
- }
-
- DateInterval interval = DateInterval(fromDate,toDate);
- ((const DateIntervalFormat*)datintv)->format( &interval, res, fp, *status );
- if (U_FAILURE(*status)) {
- return -1;
- }
- if (position != 0) {
- position->beginIndex = fp.getBeginIndex();
- position->endIndex = fp.getEndIndex();
- }
-
- return res.extract(result, resultCapacity, *status);
+ return udtitvfmt_format(datintv, fromDate, toDate, result, resultCapacity, position, status);