Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU calendars - how to handle {constrain, reject} for out-of-range {eraYear, era} value pairs? #540

Open
cjtenny opened this issue Feb 10, 2021 · 5 comments
Labels
Temporal Issues relating to Intl support in Temporal

Comments

@cjtenny
Copy link

cjtenny commented Feb 10, 2021

Context: tc39/proposal-temporal#1245 (comment)

How should the ICU calendars handle values of eraYear and era that are "out-of-bounds". For example, if an era lasts ten years, does eraYear: 15 mean 5 years into the next era? For the gregorian calendar, does {era: 'ce', eraYear: 0} mean 1 BCE?

This does not affect the ISO calendar, which does not support eras, and therefore will not lead to any changes in the stage3 "frozen" spec text. It does, at the moment, affect the polyfill.

cc @Manishearth, @justingrant

@ptomato
Copy link
Contributor

ptomato commented Feb 10, 2021

IMO it should always adjust the era accordingly. Suppose you have PlainDate.from({ era: 'reiwa', eraYear: 100, month: 1, day: 1, calendar: 'japanese' }) and the Emperor decides to retire sometime within the next 98 years. You don't want that code to either suddenly start throwing (reject) or suddenly start returning a different date than before (constrain).

@justingrant
Copy link
Contributor

IMO it should always adjust the era accordingly.

FWIW, the polyfill currently works this way.

@Manishearth
Copy link

This makes sense, though I think we should document this behavior in case folks are using the reject mode as a "strongly validate inputs" mode (if folks want this behavior they can just compare the before/after eras)

@Louis-Aime
Copy link

I agree with you all.
This is the way the original era concept is generally understood.
Strictly speaking, it is a sort of balance option.

@ptomato
Copy link
Contributor

ptomato commented Feb 18, 2021

Let's move this to the ecma402 issue tracker.

@ptomato ptomato transferred this issue from tc39/proposal-temporal Feb 18, 2021
@ptomato ptomato added the Temporal Issues relating to Intl support in Temporal label Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Temporal Issues relating to Intl support in Temporal
Projects
None yet
Development

No branches or pull requests

5 participants