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

Make format functions throw RangeError (closes #987) #1032

Merged
merged 7 commits into from Jan 10, 2019

Conversation

kossnocorp
Copy link
Member

See JavaScript's toISOString and Intl API for the reasoning:

const date = new Date()

date.setHours('nope')
//=> NaN

date.getYear()
//=> NaN

date.toString()
//=> Invalid date

date.toISOString()
//=> RangeError: Invalid time value

new Intl.DateTimeFormat('en-US').format(date)
//=> RangeError: Invalid time value

Copy link
Contributor

@leshakoss leshakoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another relevant changelog line that is not true anymore:
- and `String('Invalid Date')` for functions that return strings.

Copy link
Contributor

@leshakoss leshakoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kossnocorp kossnocorp merged commit a239752 into master Jan 10, 2019
@kossnocorp kossnocorp deleted the 987-format-throw branch January 10, 2019 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants