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

Should InitializeNumberFormat throw a TypeError when "roundingIncrement" isn't supported? #68

Closed
anba opened this issue Jul 23, 2021 · 2 comments · Fixed by #91
Closed
Assignees
Labels
bug Something isn't working has-consensus Has consensus and ready to implement

Comments

@anba
Copy link

anba commented Jul 23, 2021

InitializeDateTimeFormat and ToDateTimeOptions throw a TypeError when dateStyle/timeStyle is mixed with the other date-time component options. Is that error similar to the situation when "roundingIncrement" is used with non-fractional rounding and should therefore InitializeNumberFormat be changed to throw a TypeError instead of a RangeError? The relevant step is:

  1. If roundingIncrement is not 1 and numberFormat.[[RoundingType]] is not fractionDigits, throw a RangeError exception.

I don't have any preference here, I've just spotted this when implementing the error behaviour for "roundingIncrement".

@sffc sffc added the bug Something isn't working label Jul 24, 2021
@romulocintra romulocintra self-assigned this Mar 2, 2022
@romulocintra
Copy link
Member

Adding it for next TG2 plenary meeting agenda

@romulocintra romulocintra added the discuss Needs discussion to make progress label Mar 2, 2022
@sffc
Copy link
Collaborator

sffc commented Mar 17, 2022

TG2 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2022-03-17.md#should-initializenumberformat-throw-a-typeerror-when-roundingincrement-isnt-supported-68

Conclusion:

  • Change line 23 (the line in Andre's post) to TypeError.
  • @ryzokuken to consider adding this to the ECMA-402 style guide.

@sffc sffc added has-consensus Has consensus and ready to implement and removed discuss Needs discussion to make progress labels Mar 17, 2022
@sffc sffc closed this as completed in #91 Mar 18, 2022
sffc added a commit that referenced this issue Mar 18, 2022
InitializeNumberFormat L23 throws TypeError instead of RangeError - fix #68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has-consensus Has consensus and ready to implement
Projects
None yet
3 participants