tc39/proposal-intl-relative-time

Calendar option for non-gregorian calendars

rxaviers opened this issue · 8 comments

Add calendar option, which follows the selected language and can be overridden manually, to handle non-Gregorian calendars relative times, e.g., "13 months ago" for Chinese calendar.

This needs to be properly defined...

For context, see #6.

We just need to add a new internal slot for [[Calendar]], and the gymnastics to get the option value for that calendar. This should be very straight forward. Volunteer?

@rxaviers I don't think this is solved by #18, If I'm correct, please reopen it.

I agree with @caridy. Please reopen this issue.

It's not clear to me what we should be doing. cc @FrankYFTang

There's no notion of date on RelativeTimeFormat as can be seen by the input type being integers (all date manipulations are left to user code). At least until (or whether) a bestFit style is supported.

Right, so it's not clear what @caridy and @FranklinYu are getting at above. Maybe one of them could clarify.

Didn't read through the readme about transition from Date to integer. Sorry for the noise; @littledan @rxaviers please close this again.

sorry, I don't think it is necessary. The RelativeTimeFormat does not involve calendar at all.
And the example of ""13 months ago" for Chinese calendar." is not a good one since you can also have that in Gregorian calendar.

For example, in current v8 implementation:
out/x64.release/d8
d8> let rtf = new Intl.RelativeTimeFormat("en");
undefined
d8> rtf.format(13, "month")
"in 13 months"
d8> rtf.format(-13, "month")
"13 months ago"