Skip to content

Commit

Permalink
Add intl in staging directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditi-1400 authored and ptomato committed Aug 11, 2022
1 parent c4daf3e commit 747bed2
Show file tree
Hide file tree
Showing 13 changed files with 3,995 additions and 0 deletions.
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);
};
Loading

0 comments on commit 747bed2

Please sign in to comment.