| 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 |
es6id: 20.3.3.4 |
| 6 |
description: Values specified to MakeTime exceed their time boundaries |
| 7 |
info: | |
| 8 |
[...] |
| 9 |
9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))). |
| 10 |
|
| 11 |
MakeTime (hour, min, sec, ms) |
| 12 |
|
| 13 |
1. If hour is not finite or min is not finite or sec is not finite or ms is |
| 14 |
not finite, return NaN. |
| 15 |
2. Let h be ToInteger(hour). |
| 16 |
3. Let m be ToInteger(min). |
| 17 |
4. Let s be ToInteger(sec). |
| 18 |
5. Let milli be ToInteger(ms). |
| 19 |
6. Let t be h * msPerHour + m * msPerMinute + s * msPerSecond + milli, |
| 20 |
performing the arithmetic according to IEEE 754-2008 rules (that is, as if |
| 21 |
using the ECMAScript operators * and +). |
| 22 |
7. Return t. |
| 23 |
---*/ |
| 24 |
|
| 25 |
assert.sameValue(Date.UTC(2016, 6, 5, -1), 1467673200000, 'hour: -1'); |
| 26 |
assert.sameValue(Date.UTC(2016, 6, 5, 24), 1467763200000, 'hour: 24'); |
| 27 |
assert.sameValue(Date.UTC(2016, 6, 5, 0, -1), 1467676740000, 'minute: -1'); |
| 28 |
assert.sameValue(Date.UTC(2016, 6, 5, 0, 60), 1467680400000, 'minute: 60'); |
| 29 |
assert.sameValue(Date.UTC(2016, 6, 5, 0, 0, -1), 1467676799000, 'second: -1'); |
| 30 |
assert.sameValue(Date.UTC(2016, 6, 5, 0, 0, 60), 1467676860000, 'second: 60'); |
| 31 |
assert.sameValue( |
| 32 |
Date.UTC(2016, 6, 5, 0, 0, 0, -1), 1467676799999, 'millisecond: -1' |
| 33 |
); |
| 34 |
assert.sameValue( |
| 35 |
Date.UTC(2016, 6, 5, 0, 0, 0, 1000), 1467676801000, 'millisecond: 1000' |
| 36 |
); |