From 5de6ee0c61b38feb4e35b842bc81d9d8030d2afa Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Thu, 8 Sep 2022 16:24:43 -0700 Subject: [PATCH] ICU-21959 fix DateIntervalFormat general usage example --- .../core/src/com/ibm/icu/text/DateIntervalFormat.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/DateIntervalFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/DateIntervalFormat.java index 21c1da5973b..055975537ed 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/DateIntervalFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/DateIntervalFormat.java @@ -206,11 +206,12 @@ import com.ibm.icu.util.UResourceBundle; * // and parses into * DateInterval dtInterval = new DateInterval(1000*3600*24L, 1000*3600*24*2L); * DateIntervalFormat dtIntervalFmt = DateIntervalFormat.getInstance( - * YEAR_MONTH_DAY, Locale("en", "GB", "")); - * StringBuffer str = new StringBuffer(""); - * FieldPosition pos = new FieldPosition(0); + * DateFormat.YEAR_MONTH_DAY, new Locale("en", "GB", "")); + * StringBuffer result = new StringBuffer(""); + * FieldPosition pos = new FieldPosition(-1); * // formatting - * dtIntervalFmt.format(dtInterval, dateIntervalString, pos); + * dtIntervalFmt.format(dtInterval, result, pos); + * assertEquals("interval", "1–2 January 1970", result.toString()); * * * -- 2.40.0