tc39 / proposal-intl-relative-time

`Intl.RelativeTimeFormat` specification [draft]
http://tc39.github.io/proposal-intl-relative-time/
215 stars 24 forks source link

It would be nice to document the expected placeables in the pattern. #116

Closed zbraniecki closed 4 years ago

zbraniecki commented 4 years ago

Am I correct that "0" here comes from the requirement for the pattern to have only one placeable names 0? If that's true it may be worth documenting that requirement as well.

Originally posted by @zbraniecki in https://github.com/tc39/proposal-intl-relative-time/pull/114

littledan commented 4 years ago

I'm confused what you're asking for. The possibility of including "{0}" in the pattern is documented in https://tc39.es/proposal-intl-relative-time/#sec-Intl.RelativeTimeFormat-internal-slots .

@longlho , were you planning on following up here?

Does this need to block landing https://github.com/tc39/ecma402/pull/391 , or could we consider it as a follow-on editorial change?

zbraniecki commented 4 years ago

The spec states The value corresponding to those properties is a pattern which may contain "{0}" to be replaced by a formatted number. - what happens if the pattern does not contain {0}?

longlho commented 4 years ago

I'll have to do some digging to see if there can be multiple {0} in a pattern. More than 1 would be an issue, 0 would be fine IMO.

littledan commented 4 years ago

@zbraniecki That's expected, e.g., -1 days becoming "yesterday".

zbraniecki commented 4 years ago

Ah! Of course! Thank you both!