Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Date/UTC/year-offset.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: Conditional offset of provided `year` value
7 info: |
8 1. Let y be ? ToNumber(year).
9 [...]
10 8. If y is not NaN and 0 ≤ ToInteger(y) ≤ 99, let yr be 1900+ToInteger(y);
11 otherwise, let yr be y.
12 9. Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))).
13 ---*/
14
15 assert.sameValue(Date.UTC(-1, 0), -62198755200000, '-1 (no offset)');
16
17 assert.sameValue(Date.UTC(0, 0), -2208988800000, '+0');
18 assert.sameValue(Date.UTC(-0, 0), -2208988800000, '-0');
19 assert.sameValue(Date.UTC(-0.999999, 0), -2208988800000, '-0.999999');
20
21 assert.sameValue(Date.UTC(70, 0), 0, '70');
22 assert.sameValue(Date.UTC(70, 0), 0, '70.999999');
23
24 assert.sameValue(Date.UTC(99, 0), 915148800000, '99');
25 assert.sameValue(Date.UTC(99.999999, 0), 915148800000, '99.999999');
26
27 assert.sameValue(Date.UTC(100, 0), -59011459200000, '100 (no offset)');