-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure reference data is emitted when calendarName = 'always'
References: + tc39/proposal-temporal#1971
- Loading branch information
1 parent
9f2814f
commit 9452778
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2022 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plainmonthday | ||
description: If calendar name is to be emitted, include additional reference info | ||
features: [Temporal] | ||
---*/ | ||
|
||
const pmd = new Temporal.PlainMonthDay(10, 31, "iso8601", 2019); | ||
|
||
assert.sameValue( | ||
pmd.toString({ calendarName: 'always' }), | ||
"2019-10-31[u-ca=iso8601]", | ||
"emit year-month-day if calendarName = 'always' (four-argument constructor)" | ||
); | ||
|
||
const anotherPMD = Temporal.PlainMonthDay.from("2019-10-31"); // 2019 will get dropped | ||
|
||
assert.sameValue( | ||
anotherPMD.toString({ calendarName: 'always' }), | ||
"1972-10-31[u-ca=iso8601]", | ||
"emit fallback year if calendarName = 'always' (static from)" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2022 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plainyearmonth | ||
description: If calendar name is to be emitted, include additional reference info | ||
features: [Temporal] | ||
---*/ | ||
|
||
const pym = new Temporal.PlainYearMonth(2019, 10, "iso8601", 31); | ||
|
||
assert.sameValue( | ||
pym.toString({ calendarName: 'always' }), | ||
"2019-10-31[u-ca=iso8601]", | ||
"emit year-month-day if calendarName = 'always' (four-argument constructor)" | ||
); | ||
|
||
const anotherPYM = Temporal.PlainYearMonth.from("2019-10-31"); // 31 will get dropped | ||
|
||
assert.sameValue( | ||
anotherPYM.toString({ calendarName: 'always' }), | ||
"2019-10-01[u-ca=iso8601]", | ||
"emit fallback day if calendarName = 'always' (static from)" | ||
); |