Temporal: Test daysInWeek when the week spans across years.

This commit is contained in:
Ms2ger 2022-06-10 16:13:41 +02:00 committed by Philip Chimento
parent 79e3bc5176
commit 3343e15083
2 changed files with 16 additions and 5 deletions

View File

@ -7,5 +7,11 @@ description: Basic tests for daysInWeek().
features: [Temporal]
---*/
const plainDate = new Temporal.PlainDate(1976, 11, 18);
assert.sameValue(plainDate.daysInWeek, 7);
const tests = [
new Temporal.PlainDate(1976, 1, 1),
new Temporal.PlainDate(1976, 11, 18),
new Temporal.PlainDate(1976, 12, 31),
];
for (const plainDate of tests) {
assert.sameValue(plainDate.daysInWeek, 7, `Seven days in the week of ${plainDate}`);
}

View File

@ -7,6 +7,11 @@ description: Checking days in week for a "normal" case (non-undefined, non-bound
features: [Temporal]
---*/
const calendar = Temporal.Calendar.from("iso8601");
const datetime = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar);
assert.sameValue(datetime.daysInWeek, 7, "check days in week information");
const tests = [
new Temporal.PlainDateTime(1976, 1, 1, 15, 23, 30, 123, 456, 789),
new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789),
new Temporal.PlainDateTime(1976, 12, 31, 15, 23, 30, 123, 456, 789),
];
for (const plainDateTime of tests) {
assert.sameValue(plainDateTime.daysInWeek, 7, `Seven days in the week of ${plainDateTime}`);
}