fractional-second-digits-append-item.js (1456B)
1 // |reftest| skip-if(!this.hasOwnProperty("Intl")) 2 3 const { 4 DayPeriod, Hour, Minute, Second, FractionalSecond, Literal 5 } = DateTimeFormatParts 6 7 const tests = [ 8 // https://unicode-org.atlassian.net/browse/CLDR-13184 9 // https://unicode-org.atlassian.net/browse/CLDR-13623 10 { 11 locale: "en", 12 date: new Date("2020-01-01T00:00:00.123"), 13 options: {hour: "numeric", fractionalSecondDigits: 3}, 14 parts: [ 15 Hour("12"), 16 Literal(" "), 17 DayPeriod("AM"), 18 Literal(" (Fractional Second: "), 19 FractionalSecond("123"), 20 Literal(")") 21 ] 22 }, 23 24 // https://unicode-org.atlassian.net/browse/ICU-20992 25 { 26 locale: "ckb-IR", 27 date: new Date("2020-01-01T00:00:00.123"), 28 options: {minute: "2-digit", fractionalSecondDigits: 3}, 29 parts: [ 30 Minute("٠٠"), 31 Literal(":"), 32 Second("٠٠"), 33 Literal("٫"), 34 FractionalSecond("١٢٣"), 35 ] 36 }, 37 38 // https://unicode-org.atlassian.net/browse/ICU-20992 39 { 40 locale: "ckb-IR", 41 date: new Date("2020-01-01T00:00:00.123"), 42 options: {dayPeriod: "short", fractionalSecondDigits: 3}, 43 parts: [ 44 FractionalSecond("١٢٣"), 45 Literal(" (Dayperiod: "), 46 DayPeriod("ب.ن"), 47 Literal(")") 48 ] 49 }, 50 ]; 51 52 for (let {locale, date, options, parts} of tests) { 53 let dtf = new Intl.DateTimeFormat(locale, options); 54 assertParts(dtf, date, parts); 55 } 56 57 if (typeof reportCompare === "function") 58 reportCompare(0, 0, "ok");