-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4daf3e
commit 747bed2
Showing
13 changed files
with
3,995 additions
and
0 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
test/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js
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,93 @@ | ||
// Copyright (C) 2018 Bloomberg LP. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal-intl | ||
description: Addition across lunisolar leap months | ||
features: [Temporal] | ||
---*/ | ||
|
||
// Adding years across Hebrew leap month | ||
var date = Temporal.PlainDate.from({ | ||
year: 5783, | ||
monthCode: "M08", | ||
day: 2, | ||
calendar: "hebrew" | ||
}); | ||
var added = date.add({ years: 1 }); | ||
assert.sameValue(added.monthCode, date.monthCode); | ||
assert.sameValue(added.year, date.year + 1); | ||
|
||
// Adding months across Hebrew leap month | ||
var date = Temporal.PlainDate.from({ | ||
year: 5783, | ||
monthCode: "M08", | ||
day: 2, | ||
calendar: "hebrew" | ||
}); | ||
var added = date.add({ months: 13 }); | ||
assert.sameValue(added.monthCode, date.monthCode); | ||
assert.sameValue(added.year, date.year + 1); | ||
|
||
// Adding months and years across Hebrew leap month | ||
var date = Temporal.PlainDate.from({ | ||
year: 5783, | ||
monthCode: "M08", | ||
day: 2, | ||
calendar: "hebrew" | ||
}); | ||
var added = date.add({ | ||
years: 1, | ||
months: 12 | ||
}); | ||
assert.sameValue(added.monthCode, date.monthCode); | ||
assert.sameValue(added.year, date.year + 2); | ||
var testChineseData = new Date("2001-02-01T00:00Z").toLocaleString("en-US-u-ca-chinese", { | ||
day: "numeric", | ||
month: "numeric", | ||
year: "numeric", | ||
era: "short", | ||
timeZone: "UTC" | ||
}); | ||
var hasOutdatedChineseIcuData = !testChineseData.endsWith("2001"); | ||
|
||
// Adding years across Chinese leap month" | ||
if(hasOutdatedChineseIcuData) { | ||
var date = Temporal.PlainDate.from({ | ||
year: 2000, | ||
monthCode: "M08", | ||
day: 2, | ||
calendar: "chinese" | ||
}); | ||
var added = date.add({ years: 1 }); | ||
assert.sameValue(added.monthCode, date.monthCode); | ||
assert.sameValue(added.year, date.year + 1); | ||
} | ||
// Adding months across Chinese leap month | ||
if(hasOutdatedChineseIcuData) { | ||
var date = Temporal.PlainDate.from({ | ||
year: 2000, | ||
monthCode: "M08", | ||
day: 2, | ||
calendar: "chinese" | ||
}); | ||
var added = date.add({ months: 13 }); | ||
assert.sameValue(added.monthCode, date.monthCode); | ||
assert.sameValue(added.year, date.year + 1); | ||
} | ||
|
||
// Adding months and years across Chinese leap month | ||
if(hasOutdatedChineseIcuData) { | ||
var date = Temporal.PlainDate.from({ | ||
year: 2001, | ||
monthCode: "M08", | ||
day: 2, | ||
calendar: "chinese" | ||
}); | ||
var added = date.add({ | ||
years: 1, | ||
months: 12 | ||
}); | ||
assert.sameValue(added.monthCode, date.monthCode); | ||
assert.sameValue(added.year, date.year + 2); | ||
}; |
Oops, something went wrong.