blob: 1faed72a64a4f6775db56320d4a460cbace60070 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.dayofyear
description: >
Temporal.Calendar.prototype.dayOfYear will take ISO8601 string and
return the day of year.
info: |
4. Let temporalDate be ? ToTemporalDate(temporalDateLike).
5. Return 𝔽(! ToISODayOfYear(temporalDate.[[ISOYear]], temporalDate.[[ISOMonth]], temporalDate.[[ISODay]])).
features: [Temporal]
---*/
let cal = new Temporal.Calendar("iso8601");
assert.sameValue(
cal.dayOfYear("2019-01-18"),
18,
'cal.dayOfYear("2019-01-18") must return 18'
);
assert.sameValue(
cal.dayOfYear("2020-02-18"),
49,
'cal.dayOfYear("2020-02-18") must return 49'
);
assert.sameValue(
cal.dayOfYear("2019-12-31"),
365,
'cal.dayOfYear("2019-12-31") must return 365'
);
assert.sameValue(
cal.dayOfYear("2000-12-31"),
366,
'cal.dayOfYear("2000-12-31") must return 366'
);
reportCompare(0, 0);
|