Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow alternative era for Chinese calendar #4309

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ features: [Temporal]

// 2001 is a leap year in the Chinese calendar with a M04L leap month.
// Therefore, month: 6 is M05 in 2001 but M06 in 2000 which is not a leap year.
const one = Temporal.PlainDate.from({ year: 2000, month: 6, day: 1, calendar: 'chinese' });
const two = Temporal.PlainDate.from({ year: 2001, month: 6, day: 1, calendar: 'chinese' });

const year2000 = new Temporal.PlainDate(2000, 3, 1).withCalendar("chinese").year;
const year2001 = new Temporal.PlainDate(2001, 3, 1).withCalendar("chinese").year;

const one = Temporal.PlainDate.from({ year: year2000, month: 6, day: 1, calendar: 'chinese' });
const two = Temporal.PlainDate.from({ year: year2001, month: 6, day: 1, calendar: 'chinese' });

assert.sameValue(one.inLeapYear, false, "year 2000 is not a leap year");
assert.sameValue(one.monthCode, "M06", "sixth month in year 2000 has month code M06");

assert.sameValue(two.inLeapYear, true, "year 2001 is a leap year");
assert.sameValue(two.monthCode, "M05", "sixth month in year 2001 has month code M05");

const expected = { years: 'P12M', months: 'P12M', weeks: 'P50W4D', days: 'P354D' };

Expand Down
Loading