infinity-make-time.js (1104B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-date.utc 5 description: Infinite values specified to MakeTime produce NaN 6 info: | 7 [...] 8 9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))). 9 10 MakeTime (hour, min, sec, ms) 11 12 1. If hour is not finite or min is not finite or sec is not finite or ms is 13 not finite, return NaN. 14 ---*/ 15 16 assert.sameValue(Date.UTC(0, 0, 1, Infinity), NaN, 'hour: Infinity'); 17 assert.sameValue(Date.UTC(0, 0, 1, -Infinity), NaN, 'hour: -Infinity'); 18 19 assert.sameValue(Date.UTC(0, 0, 1, 0, Infinity), NaN, 'minute: Infinity'); 20 assert.sameValue(Date.UTC(0, 0, 1, 0, -Infinity), NaN, 'minute: -Infinity'); 21 22 assert.sameValue(Date.UTC(0, 0, 1, 0, 0, Infinity), NaN, 'second: Infinity'); 23 assert.sameValue(Date.UTC(0, 0, 1, 0, 0, -Infinity), NaN, 'second: -Infinity'); 24 25 assert.sameValue(Date.UTC(0, 0, 1, 0, 0, 0, Infinity), NaN, 'ms: Infinity'); 26 assert.sameValue(Date.UTC(0, 0, 1, 0, 0, 0, -Infinity), NaN, 'ms: -Infinity'); 27 28 reportCompare(0, 0);