diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js b/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js new file mode 100644 index 0000000000..1faed72a64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/dayOfYear/string.js @@ -0,0 +1,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); |