Closed
Description
openedon Mar 20, 2022
NaN
is replaced with zero by ToIntegerWithoutRounding step 2, but this leads to some surprising and IMO bad consequences:
new Temporal.Duration(Symbol(2022)) // TypeError 👍
new Temporal.Duration(0.5) // RangeError 👍
new Temporal.Duration(NaN) // => PT0S 😱
new Temporal.Duration("foo") // => PT0S 😱
new Temporal.Duration(/regex/) // => PT0S 😱
new Temporal.Duration(Temporal) // => PT0S 😱
Temporal.PlainDateTime.from("2022-03-20T00:00").add({days: Symbol(0)}) // => TypeError 👍
Temporal.PlainDateTime.from("2022-03-20T00:00").add({days: 0.5}) // => RangeError 👍
Temporal.PlainDateTime.from("2022-03-20T00:00").add({days: NaN}) // => 2022-03-20T00:00 😱
//…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment