-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Change Temporal.Duration constructor to throw if given a non-integer Number #1832
Labels
needs plenary input
Needs to be presented to the committee and feedback incorporated
spec-text
Specification text involved
Milestone
Comments
ptomato
added a commit
that referenced
this issue
Oct 14, 2021
The Temporal.Duration constructor, unlike Temporal.Duration.from(), would previously drop the fractional part of numbers given to it. from() throws if given a non-integer number, because Temporal.Duration.from('PT1.1H') results in 1 hour, 6 minutes, but Temporal.Duration.from({ hours: 1.1 }) cannot be exact, yet should not silently drop the .1, as discussed in issue #938. Temporal.Duration(0, 0, 0, 0, 1.1) should now throw the same exception as Temporal.Duration.from({ hours: 1.1 }) in order to be consistent and avoid the surprise to users of silently dropping the .1. Closes: #1832
ptomato
added a commit
that referenced
this issue
Oct 14, 2021
The Temporal.Duration constructor, unlike Temporal.Duration.from(), would previously drop the fractional part of numbers given to it. from() throws if given a non-integer number, because Temporal.Duration.from('PT1.1H') results in 1 hour, 6 minutes, but Temporal.Duration.from({ hours: 1.1 }) cannot be exact, yet should not silently drop the .1, as discussed in issue #938. Temporal.Duration(0, 0, 0, 0, 1.1) should now throw the same exception as Temporal.Duration.from({ hours: 1.1 }) in order to be consistent and avoid the surprise to users of silently dropping the .1. Closes: #1832
ptomato
added a commit
that referenced
this issue
Nov 4, 2021
The Temporal.Duration constructor, unlike Temporal.Duration.from(), would previously drop the fractional part of numbers given to it. from() throws if given a non-integer number, because Temporal.Duration.from('PT1.1H') results in 1 hour, 6 minutes, but Temporal.Duration.from({ hours: 1.1 }) cannot be exact, yet should not silently drop the .1, as discussed in issue #938. Temporal.Duration(0, 0, 0, 0, 1.1) should now throw the same exception as Temporal.Duration.from({ hours: 1.1 }) in order to be consistent and avoid the surprise to users of silently dropping the .1. Closes: #1832
ptomato
added a commit
that referenced
this issue
Nov 4, 2021
The Temporal.Duration constructor, unlike Temporal.Duration.from(), would previously drop the fractional part of numbers given to it. from() throws if given a non-integer number, because Temporal.Duration.from('PT1.1H') results in 1 hour, 6 minutes, but Temporal.Duration.from({ hours: 1.1 }) cannot be exact, yet should not silently drop the .1, as discussed in issue #938. Temporal.Duration(0, 0, 0, 0, 1.1) should now throw the same exception as Temporal.Duration.from({ hours: 1.1 }) in order to be consistent and avoid the surprise to users of silently dropping the .1. Closes: #1832
ptomato
added a commit
that referenced
this issue
Nov 17, 2021
The Temporal.Duration constructor, unlike Temporal.Duration.from(), would previously drop the fractional part of numbers given to it. from() throws if given a non-integer number, because Temporal.Duration.from('PT1.1H') results in 1 hour, 6 minutes, but Temporal.Duration.from({ hours: 1.1 }) cannot be exact, yet should not silently drop the .1, as discussed in issue #938. Temporal.Duration(0, 0, 0, 0, 1.1) should now throw the same exception as Temporal.Duration.from({ hours: 1.1 }) in order to be consistent and avoid the surprise to users of silently dropping the .1. Closes: #1832
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
needs plenary input
Needs to be presented to the committee and feedback incorporated
spec-text
Specification text involved
Discussed in the champions meeting of 2021-09-16, and originally raised by @rkirsling in #1704. The Temporal.Duration constructor, unlike
Temporal.Duration.from()
, drops the fractional part of numbers given to it. from() throws if given a non-integer number, becauseTemporal.Duration.from('PT1.1H')
results in 1 hour, 6 minutes, butTemporal.Duration.from({ hours: 1.1 })
cannot be exact, yet should not silently drop the .1, as discussed in #938.Temporal.Duration(0, 0, 0, 0, 1.1)
should now throw the same exception asTemporal.Duration.from({ hours: 1.1 })
in order to be consistent and avoid the surprise to users of silently dropping the .1.The text was updated successfully, but these errors were encountered: