-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move test for dates before start of the Japanese era into a new file
See also <tc39/proposal-temporal#2865> requesting for more information how this case should actually be handled.
- Loading branch information
Showing
2 changed files
with
63 additions
and
55 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,63 @@ | ||
// 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: Japanese eras | ||
features: [Temporal] | ||
---*/ | ||
|
||
// Dates in same year before Japanese era starts will resolve to previous era | ||
var date = Temporal.PlainDate.from({ | ||
era: "reiwa", | ||
eraYear: 1, | ||
month: 1, | ||
day: 1, | ||
calendar: "japanese" | ||
}); | ||
assert.sameValue(`${ date }`, "2019-01-01[u-ca=japanese]"); | ||
assert.sameValue(date.era, "heisei"); | ||
assert.sameValue(date.eraYear, 31); | ||
|
||
date = Temporal.PlainDate.from({ | ||
era: "heisei", | ||
eraYear: 1, | ||
month: 1, | ||
day: 1, | ||
calendar: "japanese" | ||
}); | ||
assert.sameValue(`${ date }`, "1989-01-01[u-ca=japanese]"); | ||
assert.sameValue(date.era, "showa"); | ||
assert.sameValue(date.eraYear, 64); | ||
date = Temporal.PlainDate.from({ | ||
era: "showa", | ||
eraYear: 1, | ||
month: 1, | ||
day: 1, | ||
calendar: "japanese" | ||
}); | ||
assert.sameValue(`${ date }`, "1926-01-01[u-ca=japanese]"); | ||
assert.sameValue(date.era, "taisho"); | ||
assert.sameValue(date.eraYear, 15); | ||
|
||
date = Temporal.PlainDate.from({ | ||
era: "taisho", | ||
eraYear: 1, | ||
month: 1, | ||
day: 1, | ||
calendar: "japanese" | ||
}); | ||
assert.sameValue(`${ date }`, "1912-01-01[u-ca=japanese]"); | ||
assert.sameValue(date.era, "meiji"); | ||
assert.sameValue(date.eraYear, 45); | ||
|
||
date = Temporal.PlainDate.from({ | ||
era: "meiji", | ||
eraYear: 1, | ||
month: 1, | ||
day: 1, | ||
calendar: "japanese" | ||
}); | ||
assert.sameValue(`${ date }`, "1868-01-01[u-ca=japanese]"); | ||
assert.sameValue(date.era, "ce"); | ||
assert.sameValue(date.eraYear, 1868); |
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