zero.js (1071B)
1 // Copyright (C) 2018 Andrew Paprocki. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-date.parse 6 description: > 7 Date.parse of toString/toUTCString/toISOString of zero value is zero 8 info: | 9 Date.parse ( string ) 10 11 If x is any Date object whose milliseconds amount is zero within a 12 particular implementation of ECMAScript, then all of the following 13 expressions should produce the same numeric value in that 14 implementation, if all the properties referenced have their initial 15 values: 16 17 x.valueOf() 18 Date.parse(x.toString()) 19 Date.parse(x.toUTCString()) 20 Date.parse(x.toISOString()) 21 ---*/ 22 23 const zero = new Date(0); 24 25 assert.sameValue(zero.valueOf(), Date.parse(zero.toString()), 26 "Date.parse(zeroDate.toString())"); 27 assert.sameValue(zero.valueOf(), Date.parse(zero.toUTCString()), 28 "Date.parse(zeroDate.toUTCString())"); 29 assert.sameValue(zero.valueOf(), Date.parse(zero.toISOString()), 30 "Date.parse(zeroDate.toISOString())"); 31 32 reportCompare(0, 0);