ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Sequence unit formatting

Open sffc opened this issue 5 years ago • 21 comments

Sequence units are things like "feet and inches", "hours and minutes", etc.

I have a CLDR proposal to extend unit identifier syntax to support sequence units with the + separator:

  • foot+inch
  • meter+centimeter
  • hour+minute+second

If we adopted this extension into ECMA-402, then this is how we could format sequence units:

const fmt = new Intl.NumberFormat("de-CH", {
    style: "unit",
    unit: "meter+centimeter"
});
console.log(fmt.format(125));
// "1 m 25 cm"

@younies @littledan @zbraniecki @longlho

sffc avatar Jan 10 '20 03:01 sffc