Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Date/UTC/overflow-make-day.js

raw
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 MakeDay exceed their calendar boundaries
7 info: |
8 [...]
9 9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
10
11 MakeDay (year, month, date)
12
13 [...]
14 5. Let ym be y + floor(m / 12).
15 [...]
16 7. Find a value t such that YearFromTime(t) is ym and MonthFromTime(t) is mn
17 and DateFromTime(t) is 1; but if this is not possible (because some
18 argument is out of range), return NaN.
19 8. Return Day(t) + dt - 1.
20 ---*/
21
22 assert.sameValue(Date.UTC(2016, 12), 1483228800000, 'month: 12');
23 assert.sameValue(Date.UTC(2016, 13), 1485907200000, 'month: 13');
24 assert.sameValue(Date.UTC(2016, 144), 1830297600000, 'month: 144');
25
26 assert.sameValue(Date.UTC(2016, 0, 33), 1454371200000, 'day greater than month');
27 assert.sameValue(Date.UTC(2016, 2, -27), 1454371200000, 'day negative value');