Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Calendar option for non-gregorian calendars #13

Closed
rxaviers opened this issue Mar 15, 2017 · 8 comments
Closed

Calendar option for non-gregorian calendars #13

rxaviers opened this issue Mar 15, 2017 · 8 comments

Comments

@rxaviers
Copy link
Member

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.

@caridy
Copy link
Collaborator

caridy commented Mar 17, 2017

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?

@caridy
Copy link
Collaborator

caridy commented Mar 31, 2017

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

@FranklinYu
Copy link

I agree with @caridy. Please reopen this issue.

@littledan
Copy link
Member

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

@littledan littledan reopened this Dec 7, 2018
@rxaviers
Copy link
Member Author

rxaviers commented Dec 7, 2018

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.

@littledan
Copy link
Member

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

@FranklinYu
Copy link

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

@FrankYFTang
Copy link
Contributor

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"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants