| OLD | NEW |
| (Empty) |
| 1 description("Tests for Date.toISOString"); | |
| 2 | |
| 3 function throwsRangeError(str) | |
| 4 { | |
| 5 try { | |
| 6 eval(str); | |
| 7 } catch (e) { | |
| 8 return e instanceof RangeError; | |
| 9 } | |
| 10 return false; | |
| 11 } | |
| 12 | |
| 13 shouldThrow("Date.toISOString.call({})"); | |
| 14 shouldThrow("Date.toISOString.call(0)"); | |
| 15 | |
| 16 shouldBe("new Date(-400).toISOString()", "'1969-12-31T23:59:59.600Z'"); | |
| 17 shouldBe("new Date(0).toISOString()", "'1970-01-01T00:00:00.000Z'"); | |
| 18 shouldBe("new Date('1 January 1500 UTC').toISOString()", "'1500-01-01T00:00:00.0
00Z'"); | |
| 19 shouldBe("new Date('1 January 2000 UTC').toISOString()", "'2000-01-01T00:00:00.0
00Z'"); | |
| 20 shouldBe("new Date('1 January 4000 UTC').toISOString()", "'4000-01-01T00:00:00.0
00Z'"); | |
| 21 shouldBe("new Date('1 January 100000 UTC').toISOString()", "'+100000-01-01T00:00
:00.000Z'"); | |
| 22 shouldBe("new Date('1 January -1 UTC').toISOString()", "'-000001-01-01T00:00:00.
000Z'"); | |
| 23 shouldBe("new Date('10 March 2000 UTC').toISOString()", "'2000-03-10T00:00:00.00
0Z'"); | |
| 24 shouldBeTrue('throwsRangeError("new Date(NaN).toISOString()")'); | |
| OLD | NEW |