mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Validate required methods of Temporal Calendar protocol
Checking whether an object implements the Calendar protocol is now done by means of HasProperty operations for each of the required methods unless the object already has the Calendar brand. Discussion: https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753 Corresponding normative PR: https://github.com/tc39/proposal-temporal/pull/2485
This commit is contained in:
parent
d6a24fe906
commit
33865c5339
@ -1464,6 +1464,34 @@ var TemporalHelpers = {
|
|||||||
* objectName is used in the log.
|
* objectName is used in the log.
|
||||||
*/
|
*/
|
||||||
calendarObserver(calls, objectName, methodOverrides = {}) {
|
calendarObserver(calls, objectName, methodOverrides = {}) {
|
||||||
|
function removeExtraHasPropertyChecks(objectName, calls) {
|
||||||
|
// Inserting the tracking calendar into the return values of methods
|
||||||
|
// that we chain up into the ISO calendar for, causes extra HasProperty
|
||||||
|
// checks, which we observe. This removes them so that we don't leak
|
||||||
|
// implementation details of the helper into the test code.
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.yearOfWeek`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.yearMonthFromFields`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.year`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.weekOfYear`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.monthsInYear`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.monthDayFromFields`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.monthCode`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.month`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.mergeFields`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.inLeapYear`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.id`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.fields`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.daysInYear`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.daysInWeek`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.daysInMonth`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.dayOfYear`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.dayOfWeek`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.day`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.dateUntil`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.dateFromFields`);
|
||||||
|
assert.sameValue(calls.pop(), `has ${objectName}.dateAdd`);
|
||||||
|
}
|
||||||
|
|
||||||
const iso8601 = new Temporal.Calendar("iso8601");
|
const iso8601 = new Temporal.Calendar("iso8601");
|
||||||
const trackingMethods = {
|
const trackingMethods = {
|
||||||
dateFromFields(...args) {
|
dateFromFields(...args) {
|
||||||
@ -1475,7 +1503,9 @@ var TemporalHelpers = {
|
|||||||
const originalResult = iso8601.dateFromFields(...args);
|
const originalResult = iso8601.dateFromFields(...args);
|
||||||
// Replace the calendar in the result with the call-tracking calendar
|
// Replace the calendar in the result with the call-tracking calendar
|
||||||
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
||||||
return new Temporal.PlainDate(isoYear, isoMonth, isoDay, this);
|
const result = new Temporal.PlainDate(isoYear, isoMonth, isoDay, this);
|
||||||
|
removeExtraHasPropertyChecks(objectName, calls);
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
yearMonthFromFields(...args) {
|
yearMonthFromFields(...args) {
|
||||||
calls.push(`call ${objectName}.yearMonthFromFields`);
|
calls.push(`call ${objectName}.yearMonthFromFields`);
|
||||||
@ -1486,7 +1516,9 @@ var TemporalHelpers = {
|
|||||||
const originalResult = iso8601.yearMonthFromFields(...args);
|
const originalResult = iso8601.yearMonthFromFields(...args);
|
||||||
// Replace the calendar in the result with the call-tracking calendar
|
// Replace the calendar in the result with the call-tracking calendar
|
||||||
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
||||||
return new Temporal.PlainYearMonth(isoYear, isoMonth, this, isoDay);
|
const result = new Temporal.PlainYearMonth(isoYear, isoMonth, this, isoDay);
|
||||||
|
removeExtraHasPropertyChecks(objectName, calls);
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
monthDayFromFields(...args) {
|
monthDayFromFields(...args) {
|
||||||
calls.push(`call ${objectName}.monthDayFromFields`);
|
calls.push(`call ${objectName}.monthDayFromFields`);
|
||||||
@ -1497,7 +1529,9 @@ var TemporalHelpers = {
|
|||||||
const originalResult = iso8601.monthDayFromFields(...args);
|
const originalResult = iso8601.monthDayFromFields(...args);
|
||||||
// Replace the calendar in the result with the call-tracking calendar
|
// Replace the calendar in the result with the call-tracking calendar
|
||||||
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
||||||
return new Temporal.PlainMonthDay(isoMonth, isoDay, this, isoYear);
|
const result = new Temporal.PlainMonthDay(isoMonth, isoDay, this, isoYear);
|
||||||
|
removeExtraHasPropertyChecks(objectName, calls);
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
dateAdd(...args) {
|
dateAdd(...args) {
|
||||||
calls.push(`call ${objectName}.dateAdd`);
|
calls.push(`call ${objectName}.dateAdd`);
|
||||||
@ -1507,12 +1541,34 @@ var TemporalHelpers = {
|
|||||||
}
|
}
|
||||||
const originalResult = iso8601.dateAdd(...args);
|
const originalResult = iso8601.dateAdd(...args);
|
||||||
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
const {isoYear, isoMonth, isoDay} = originalResult.getISOFields();
|
||||||
return new Temporal.PlainDate(isoYear, isoMonth, isoDay, this);
|
const result = new Temporal.PlainDate(isoYear, isoMonth, isoDay, this);
|
||||||
|
removeExtraHasPropertyChecks(objectName, calls);
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
id: "iso8601",
|
id: "iso8601",
|
||||||
};
|
};
|
||||||
// Automatically generate the other methods that don't need any custom code
|
// Automatically generate the other methods that don't need any custom code
|
||||||
["toString", "dateUntil", "era", "eraYear", "year", "month", "monthCode", "day", "daysInMonth", "fields", "mergeFields"].forEach((methodName) => {
|
[
|
||||||
|
"dateUntil",
|
||||||
|
"day",
|
||||||
|
"dayOfWeek",
|
||||||
|
"dayOfYear",
|
||||||
|
"daysInMonth",
|
||||||
|
"daysInWeek",
|
||||||
|
"daysInYear",
|
||||||
|
"era",
|
||||||
|
"eraYear",
|
||||||
|
"fields",
|
||||||
|
"inLeapYear",
|
||||||
|
"mergeFields",
|
||||||
|
"month",
|
||||||
|
"monthCode",
|
||||||
|
"monthsInYear",
|
||||||
|
"toString",
|
||||||
|
"weekOfYear",
|
||||||
|
"year",
|
||||||
|
"yearOfWeek",
|
||||||
|
].forEach((methodName) => {
|
||||||
trackingMethods[methodName] = function (...args) {
|
trackingMethods[methodName] = function (...args) {
|
||||||
calls.push(`call ${formatPropertyName(methodName, objectName)}`);
|
calls.push(`call ${formatPropertyName(methodName, objectName)}`);
|
||||||
if (methodName in methodOverrides) {
|
if (methodName in methodOverrides) {
|
||||||
|
@ -3,9 +3,33 @@
|
|||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.calendar.from
|
esid: sec-temporal.calendar.from
|
||||||
description: Converting a plain object to Temporal.Calendar gives the same object
|
description: >
|
||||||
|
Converting an object implementing the Calendar protocol to Temporal.Calendar
|
||||||
|
gives the same object
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const custom = { id: "custom-calendar" };
|
const custom = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "custom-calendar",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
assert.sameValue(Temporal.Calendar.from(custom), custom);
|
assert.sameValue(Temporal.Calendar.from(custom), custom);
|
||||||
|
@ -15,7 +15,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -9,8 +9,29 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalDate → GetTemporalCalendarWithISODefault
|
// ToTemporalDate → GetTemporalCalendarSlotValueWithISODefault
|
||||||
"get date.calendar",
|
"get date.calendar",
|
||||||
|
"has date.calendar.dateAdd",
|
||||||
|
"has date.calendar.dateFromFields",
|
||||||
|
"has date.calendar.dateUntil",
|
||||||
|
"has date.calendar.day",
|
||||||
|
"has date.calendar.dayOfWeek",
|
||||||
|
"has date.calendar.dayOfYear",
|
||||||
|
"has date.calendar.daysInMonth",
|
||||||
|
"has date.calendar.daysInWeek",
|
||||||
|
"has date.calendar.daysInYear",
|
||||||
|
"has date.calendar.fields",
|
||||||
|
"has date.calendar.id",
|
||||||
|
"has date.calendar.inLeapYear",
|
||||||
|
"has date.calendar.mergeFields",
|
||||||
|
"has date.calendar.month",
|
||||||
|
"has date.calendar.monthCode",
|
||||||
|
"has date.calendar.monthDayFromFields",
|
||||||
|
"has date.calendar.monthsInYear",
|
||||||
|
"has date.calendar.weekOfYear",
|
||||||
|
"has date.calendar.year",
|
||||||
|
"has date.calendar.yearMonthFromFields",
|
||||||
|
"has date.calendar.yearOfWeek",
|
||||||
// ToTemporalDate → CalendarFields
|
// ToTemporalDate → CalendarFields
|
||||||
"get date.calendar.fields",
|
"get date.calendar.fields",
|
||||||
"call date.calendar.fields",
|
"call date.calendar.fields",
|
||||||
|
@ -18,7 +18,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -29,8 +28,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -9,8 +9,29 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalDate 1 → GetTemporalCalendarWithISODefault
|
// ToTemporalDate 1 → GetTemporalCalendarSlotValueWithISODefault
|
||||||
"get one.calendar",
|
"get one.calendar",
|
||||||
|
"has one.calendar.dateAdd",
|
||||||
|
"has one.calendar.dateFromFields",
|
||||||
|
"has one.calendar.dateUntil",
|
||||||
|
"has one.calendar.day",
|
||||||
|
"has one.calendar.dayOfWeek",
|
||||||
|
"has one.calendar.dayOfYear",
|
||||||
|
"has one.calendar.daysInMonth",
|
||||||
|
"has one.calendar.daysInWeek",
|
||||||
|
"has one.calendar.daysInYear",
|
||||||
|
"has one.calendar.fields",
|
||||||
|
"has one.calendar.id",
|
||||||
|
"has one.calendar.inLeapYear",
|
||||||
|
"has one.calendar.mergeFields",
|
||||||
|
"has one.calendar.month",
|
||||||
|
"has one.calendar.monthCode",
|
||||||
|
"has one.calendar.monthDayFromFields",
|
||||||
|
"has one.calendar.monthsInYear",
|
||||||
|
"has one.calendar.weekOfYear",
|
||||||
|
"has one.calendar.year",
|
||||||
|
"has one.calendar.yearMonthFromFields",
|
||||||
|
"has one.calendar.yearOfWeek",
|
||||||
// ToTemporalDate 1 → CalendarFields
|
// ToTemporalDate 1 → CalendarFields
|
||||||
"get one.calendar.fields",
|
"get one.calendar.fields",
|
||||||
"call one.calendar.fields",
|
"call one.calendar.fields",
|
||||||
@ -30,8 +51,29 @@ const expected = [
|
|||||||
// ToTemporalDate 1 → CalendarDateFromFields
|
// ToTemporalDate 1 → CalendarDateFromFields
|
||||||
"get one.calendar.dateFromFields",
|
"get one.calendar.dateFromFields",
|
||||||
"call one.calendar.dateFromFields",
|
"call one.calendar.dateFromFields",
|
||||||
// ToTemporalDate 2 → GetTemporalCalendarWithISODefault
|
// ToTemporalDate 2 → GetTemporalCalendarSlotValueWithISODefault
|
||||||
"get two.calendar",
|
"get two.calendar",
|
||||||
|
"has two.calendar.dateAdd",
|
||||||
|
"has two.calendar.dateFromFields",
|
||||||
|
"has two.calendar.dateUntil",
|
||||||
|
"has two.calendar.day",
|
||||||
|
"has two.calendar.dayOfWeek",
|
||||||
|
"has two.calendar.dayOfYear",
|
||||||
|
"has two.calendar.daysInMonth",
|
||||||
|
"has two.calendar.daysInWeek",
|
||||||
|
"has two.calendar.daysInYear",
|
||||||
|
"has two.calendar.fields",
|
||||||
|
"has two.calendar.id",
|
||||||
|
"has two.calendar.inLeapYear",
|
||||||
|
"has two.calendar.mergeFields",
|
||||||
|
"has two.calendar.month",
|
||||||
|
"has two.calendar.monthCode",
|
||||||
|
"has two.calendar.monthDayFromFields",
|
||||||
|
"has two.calendar.monthsInYear",
|
||||||
|
"has two.calendar.weekOfYear",
|
||||||
|
"has two.calendar.year",
|
||||||
|
"has two.calendar.yearMonthFromFields",
|
||||||
|
"has two.calendar.yearOfWeek",
|
||||||
// ToTemporalDate 2 → CalendarFields
|
// ToTemporalDate 2 → CalendarFields
|
||||||
"get two.calendar.fields",
|
"get two.calendar.fields",
|
||||||
"call two.calendar.fields",
|
"call two.calendar.fields",
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -88,6 +88,27 @@ actual.splice(0); // clear
|
|||||||
const expectedOpsForPlainRelativeTo = expected.concat([
|
const expectedOpsForPlainRelativeTo = expected.concat([
|
||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
"get options.relativeTo.day",
|
"get options.relativeTo.day",
|
||||||
@ -153,6 +174,27 @@ actual.splice(0); // clear
|
|||||||
const expectedOpsForZonedRelativeTo = expected.concat([
|
const expectedOpsForZonedRelativeTo = expected.concat([
|
||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
"get options.relativeTo.day",
|
"get options.relativeTo.day",
|
||||||
|
@ -71,6 +71,27 @@ actual.splice(0); // clear
|
|||||||
const expectedOpsForPlainRelativeTo = expected.concat([
|
const expectedOpsForPlainRelativeTo = expected.concat([
|
||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
// PrepareTemporalFields
|
// PrepareTemporalFields
|
||||||
@ -135,6 +156,27 @@ actual.splice(0); // clear
|
|||||||
const expectedOpsForZonedRelativeTo = expected.concat([
|
const expectedOpsForZonedRelativeTo = expected.concat([
|
||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
// PrepareTemporalFields
|
// PrepareTemporalFields
|
||||||
|
@ -18,7 +18,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"],
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
||||||
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
||||||
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
||||||
|
@ -48,6 +48,27 @@ const expectedOpsForPlainRelativeTo = [
|
|||||||
"call options.largestUnit.toString",
|
"call options.largestUnit.toString",
|
||||||
"get options.relativeTo",
|
"get options.relativeTo",
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
"get options.relativeTo.day",
|
"get options.relativeTo.day",
|
||||||
@ -230,6 +251,27 @@ const expectedOpsForZonedRelativeTo = [
|
|||||||
"call options.largestUnit.toString",
|
"call options.largestUnit.toString",
|
||||||
"get options.relativeTo",
|
"get options.relativeTo",
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
"get options.relativeTo.day",
|
"get options.relativeTo.day",
|
||||||
|
@ -18,7 +18,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"],
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
||||||
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
||||||
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
||||||
|
@ -71,6 +71,27 @@ actual.splice(0); // clear
|
|||||||
const expectedOpsForPlainRelativeTo = expected.concat([
|
const expectedOpsForPlainRelativeTo = expected.concat([
|
||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
// PrepareTemporalFields
|
// PrepareTemporalFields
|
||||||
@ -135,6 +156,27 @@ actual.splice(0); // clear
|
|||||||
const expectedOpsForZonedRelativeTo = expected.concat([
|
const expectedOpsForZonedRelativeTo = expected.concat([
|
||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
// PrepareTemporalFields
|
// PrepareTemporalFields
|
||||||
|
@ -18,7 +18,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"],
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
||||||
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
||||||
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
||||||
|
@ -36,6 +36,27 @@ const expectedOpsForPlainRelativeTo = [
|
|||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo",
|
"get options.relativeTo",
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
"get options.relativeTo.day",
|
"get options.relativeTo.day",
|
||||||
@ -143,6 +164,27 @@ const expectedOpsForZonedRelativeTo = [
|
|||||||
// ToRelativeTemporalObject
|
// ToRelativeTemporalObject
|
||||||
"get options.relativeTo",
|
"get options.relativeTo",
|
||||||
"get options.relativeTo.calendar",
|
"get options.relativeTo.calendar",
|
||||||
|
"has options.relativeTo.calendar.dateAdd",
|
||||||
|
"has options.relativeTo.calendar.dateFromFields",
|
||||||
|
"has options.relativeTo.calendar.dateUntil",
|
||||||
|
"has options.relativeTo.calendar.day",
|
||||||
|
"has options.relativeTo.calendar.dayOfWeek",
|
||||||
|
"has options.relativeTo.calendar.dayOfYear",
|
||||||
|
"has options.relativeTo.calendar.daysInMonth",
|
||||||
|
"has options.relativeTo.calendar.daysInWeek",
|
||||||
|
"has options.relativeTo.calendar.daysInYear",
|
||||||
|
"has options.relativeTo.calendar.fields",
|
||||||
|
"has options.relativeTo.calendar.id",
|
||||||
|
"has options.relativeTo.calendar.inLeapYear",
|
||||||
|
"has options.relativeTo.calendar.mergeFields",
|
||||||
|
"has options.relativeTo.calendar.month",
|
||||||
|
"has options.relativeTo.calendar.monthCode",
|
||||||
|
"has options.relativeTo.calendar.monthDayFromFields",
|
||||||
|
"has options.relativeTo.calendar.monthsInYear",
|
||||||
|
"has options.relativeTo.calendar.weekOfYear",
|
||||||
|
"has options.relativeTo.calendar.year",
|
||||||
|
"has options.relativeTo.calendar.yearMonthFromFields",
|
||||||
|
"has options.relativeTo.calendar.yearOfWeek",
|
||||||
"get options.relativeTo.calendar.fields",
|
"get options.relativeTo.calendar.fields",
|
||||||
"call options.relativeTo.calendar.fields",
|
"call options.relativeTo.calendar.fields",
|
||||||
"get options.relativeTo.day",
|
"get options.relativeTo.day",
|
||||||
|
@ -18,7 +18,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -28,7 +27,8 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"],
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
[Temporal.PlainDate, "Temporal.PlainDate, object"],
|
||||||
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
[Temporal.PlainDate.prototype, "Temporal.PlainDate.prototype, object"],
|
||||||
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
[Temporal.ZonedDateTime, "Temporal.ZonedDateTime, object"],
|
||||||
|
@ -17,7 +17,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -26,6 +25,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -15,7 +15,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -17,6 +17,27 @@ const expected = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const calendar = function() {};
|
const calendar = function() {};
|
||||||
|
calendar.dateAdd = () => {};
|
||||||
|
calendar.dateFromFields = () => {};
|
||||||
|
calendar.dateUntil = () => {};
|
||||||
|
calendar.day = () => {};
|
||||||
|
calendar.dayOfWeek = () => {};
|
||||||
|
calendar.dayOfYear = () => {};
|
||||||
|
calendar.daysInMonth = () => {};
|
||||||
|
calendar.daysInWeek = () => {};
|
||||||
|
calendar.daysInYear = () => {};
|
||||||
|
calendar.fields = () => {};
|
||||||
|
calendar.id = "test-calendar";
|
||||||
|
calendar.inLeapYear = () => {};
|
||||||
|
calendar.mergeFields = () => {};
|
||||||
|
calendar.month = () => {};
|
||||||
|
calendar.monthCode = () => {};
|
||||||
|
calendar.monthDayFromFields = () => {};
|
||||||
|
calendar.monthsInYear = () => {};
|
||||||
|
calendar.weekOfYear = () => {};
|
||||||
|
calendar.year = () => {};
|
||||||
|
calendar.yearMonthFromFields = () => {};
|
||||||
|
calendar.yearOfWeek = () => {};
|
||||||
|
|
||||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
||||||
getOffsetNanosecondsFor(instant) {
|
getOffsetNanosecondsFor(instant) {
|
||||||
|
@ -9,6 +9,29 @@ features: [Proxy, Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
const expected = [
|
||||||
|
"has calendar.dateAdd",
|
||||||
|
"has calendar.dateFromFields",
|
||||||
|
"has calendar.dateUntil",
|
||||||
|
"has calendar.day",
|
||||||
|
"has calendar.dayOfWeek",
|
||||||
|
"has calendar.dayOfYear",
|
||||||
|
"has calendar.daysInMonth",
|
||||||
|
"has calendar.daysInWeek",
|
||||||
|
"has calendar.daysInYear",
|
||||||
|
"has calendar.fields",
|
||||||
|
"has calendar.id",
|
||||||
|
"has calendar.inLeapYear",
|
||||||
|
"has calendar.mergeFields",
|
||||||
|
"has calendar.month",
|
||||||
|
"has calendar.monthCode",
|
||||||
|
"has calendar.monthDayFromFields",
|
||||||
|
"has calendar.monthsInYear",
|
||||||
|
"has calendar.weekOfYear",
|
||||||
|
"has calendar.year",
|
||||||
|
"has calendar.yearMonthFromFields",
|
||||||
|
"has calendar.yearOfWeek",
|
||||||
|
];
|
||||||
|
|
||||||
const calendar = TemporalHelpers.calendarObserver(actual, "calendar", {
|
const calendar = TemporalHelpers.calendarObserver(actual, "calendar", {
|
||||||
toString: "iso8601",
|
toString: "iso8601",
|
||||||
@ -23,4 +46,4 @@ Object.defineProperty(Temporal.Calendar, 'from', {
|
|||||||
|
|
||||||
Temporal.Now.plainDateTime(calendar);
|
Temporal.Now.plainDateTime(calendar);
|
||||||
|
|
||||||
assert.compareArray(actual, [], 'no observable operations should be invoked');
|
assert.compareArray(actual, expected, 'order of observable operations');
|
||||||
|
@ -15,7 +15,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -14,6 +14,27 @@ const expected = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const calendar = function() {};
|
const calendar = function() {};
|
||||||
|
calendar.dateAdd = () => {};
|
||||||
|
calendar.dateFromFields = () => {};
|
||||||
|
calendar.dateUntil = () => {};
|
||||||
|
calendar.day = () => {};
|
||||||
|
calendar.dayOfWeek = () => {};
|
||||||
|
calendar.dayOfYear = () => {};
|
||||||
|
calendar.daysInMonth = () => {};
|
||||||
|
calendar.daysInWeek = () => {};
|
||||||
|
calendar.daysInYear = () => {};
|
||||||
|
calendar.fields = () => {};
|
||||||
|
calendar.id = "test-calendar";
|
||||||
|
calendar.inLeapYear = () => {};
|
||||||
|
calendar.mergeFields = () => {};
|
||||||
|
calendar.month = () => {};
|
||||||
|
calendar.monthCode = () => {};
|
||||||
|
calendar.monthDayFromFields = () => {};
|
||||||
|
calendar.monthsInYear = () => {};
|
||||||
|
calendar.weekOfYear = () => {};
|
||||||
|
calendar.year = () => {};
|
||||||
|
calendar.yearMonthFromFields = () => {};
|
||||||
|
calendar.yearOfWeek = () => {};
|
||||||
|
|
||||||
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
||||||
getOffsetNanosecondsFor(instant) {
|
getOffsetNanosecondsFor(instant) {
|
||||||
|
@ -9,6 +9,29 @@ features: [Proxy, Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
const expected = [
|
||||||
|
"has calendar.dateAdd",
|
||||||
|
"has calendar.dateFromFields",
|
||||||
|
"has calendar.dateUntil",
|
||||||
|
"has calendar.day",
|
||||||
|
"has calendar.dayOfWeek",
|
||||||
|
"has calendar.dayOfYear",
|
||||||
|
"has calendar.daysInMonth",
|
||||||
|
"has calendar.daysInWeek",
|
||||||
|
"has calendar.daysInYear",
|
||||||
|
"has calendar.fields",
|
||||||
|
"has calendar.id",
|
||||||
|
"has calendar.inLeapYear",
|
||||||
|
"has calendar.mergeFields",
|
||||||
|
"has calendar.month",
|
||||||
|
"has calendar.monthCode",
|
||||||
|
"has calendar.monthDayFromFields",
|
||||||
|
"has calendar.monthsInYear",
|
||||||
|
"has calendar.weekOfYear",
|
||||||
|
"has calendar.year",
|
||||||
|
"has calendar.yearMonthFromFields",
|
||||||
|
"has calendar.yearOfWeek",
|
||||||
|
];
|
||||||
|
|
||||||
const calendar = TemporalHelpers.calendarObserver(actual, "calendar", {
|
const calendar = TemporalHelpers.calendarObserver(actual, "calendar", {
|
||||||
toString: "iso8601",
|
toString: "iso8601",
|
||||||
@ -23,4 +46,4 @@ Object.defineProperty(Temporal.Calendar, 'from', {
|
|||||||
|
|
||||||
Temporal.Now.zonedDateTime(calendar);
|
Temporal.Now.zonedDateTime(calendar);
|
||||||
|
|
||||||
assert.compareArray(actual, [], 'no observable operations should be invoked');
|
assert.compareArray(actual, expected, 'order of observable operations');
|
||||||
|
@ -15,7 +15,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -24,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -15,7 +15,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -26,8 +25,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -10,6 +10,27 @@ features: [Temporal]
|
|||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
"get fields.calendar",
|
"get fields.calendar",
|
||||||
|
"has fields.calendar.dateAdd",
|
||||||
|
"has fields.calendar.dateFromFields",
|
||||||
|
"has fields.calendar.dateUntil",
|
||||||
|
"has fields.calendar.day",
|
||||||
|
"has fields.calendar.dayOfWeek",
|
||||||
|
"has fields.calendar.dayOfYear",
|
||||||
|
"has fields.calendar.daysInMonth",
|
||||||
|
"has fields.calendar.daysInWeek",
|
||||||
|
"has fields.calendar.daysInYear",
|
||||||
|
"has fields.calendar.fields",
|
||||||
|
"has fields.calendar.id",
|
||||||
|
"has fields.calendar.inLeapYear",
|
||||||
|
"has fields.calendar.mergeFields",
|
||||||
|
"has fields.calendar.month",
|
||||||
|
"has fields.calendar.monthCode",
|
||||||
|
"has fields.calendar.monthDayFromFields",
|
||||||
|
"has fields.calendar.monthsInYear",
|
||||||
|
"has fields.calendar.weekOfYear",
|
||||||
|
"has fields.calendar.year",
|
||||||
|
"has fields.calendar.yearMonthFromFields",
|
||||||
|
"has fields.calendar.yearOfWeek",
|
||||||
"get fields.calendar.fields",
|
"get fields.calendar.fields",
|
||||||
"call fields.calendar.fields",
|
"call fields.calendar.fields",
|
||||||
"get fields.day",
|
"get fields.day",
|
||||||
|
@ -11,6 +11,28 @@ const instance = new Temporal.PlainDate(2000, 5, 2);
|
|||||||
assert.sameValue(instance.equals({ year: 2000, month: 5, day: 2 }), true, "same date");
|
assert.sameValue(instance.equals({ year: 2000, month: 5, day: 2 }), true, "same date");
|
||||||
assert.sameValue(instance.equals({ year: 2000, month: 5, day: 4 }), false, "different date");
|
assert.sameValue(instance.equals({ year: 2000, month: 5, day: 4 }), false, "different date");
|
||||||
|
|
||||||
const calendar = { id: "a" };
|
const calendar = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "a",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
assert.sameValue(instance.withCalendar(calendar).equals({ year: 2000, month: 5, day: 2 }),
|
assert.sameValue(instance.withCalendar(calendar).equals({ year: 2000, month: 5, day: 2 }),
|
||||||
false, "different calendar");
|
false, "different calendar");
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -11,5 +11,27 @@ const instance = new Temporal.PlainDate(2000, 5, 2);
|
|||||||
assert.sameValue(instance.equals("2000-05-02"), true, "same date");
|
assert.sameValue(instance.equals("2000-05-02"), true, "same date");
|
||||||
assert.sameValue(instance.equals("2000-05-04"), false, "different date");
|
assert.sameValue(instance.equals("2000-05-04"), false, "different date");
|
||||||
|
|
||||||
const calendar = { id: "a" };
|
const calendar = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "a",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
assert.sameValue(instance.withCalendar(calendar).equals("2000-05-02"), false, "different calendar");
|
assert.sameValue(instance.withCalendar(calendar).equals("2000-05-02"), false, "different calendar");
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -7,8 +7,52 @@ description: RangeError thrown if calendars' id properties do not match
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const calendar1 = { id: "A" };
|
const calendar1 = {
|
||||||
const calendar2 = { id: "B" };
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "A",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
const calendar2 = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "B",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const plainDate1 = new Temporal.PlainDate(2000, 1, 1, calendar1);
|
const plainDate1 = new Temporal.PlainDate(2000, 1, 1, calendar1);
|
||||||
const plainDate2 = new Temporal.PlainDate(2000, 1, 1, calendar2);
|
const plainDate2 = new Temporal.PlainDate(2000, 1, 1, calendar2);
|
||||||
|
@ -11,6 +11,27 @@ features: [Temporal]
|
|||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalDate
|
// ToTemporalDate
|
||||||
"get other.calendar",
|
"get other.calendar",
|
||||||
|
"has other.calendar.dateAdd",
|
||||||
|
"has other.calendar.dateFromFields",
|
||||||
|
"has other.calendar.dateUntil",
|
||||||
|
"has other.calendar.day",
|
||||||
|
"has other.calendar.dayOfWeek",
|
||||||
|
"has other.calendar.dayOfYear",
|
||||||
|
"has other.calendar.daysInMonth",
|
||||||
|
"has other.calendar.daysInWeek",
|
||||||
|
"has other.calendar.daysInYear",
|
||||||
|
"has other.calendar.fields",
|
||||||
|
"has other.calendar.id",
|
||||||
|
"has other.calendar.inLeapYear",
|
||||||
|
"has other.calendar.mergeFields",
|
||||||
|
"has other.calendar.month",
|
||||||
|
"has other.calendar.monthCode",
|
||||||
|
"has other.calendar.monthDayFromFields",
|
||||||
|
"has other.calendar.monthsInYear",
|
||||||
|
"has other.calendar.weekOfYear",
|
||||||
|
"has other.calendar.year",
|
||||||
|
"has other.calendar.yearMonthFromFields",
|
||||||
|
"has other.calendar.yearOfWeek",
|
||||||
"get other.calendar.fields",
|
"get other.calendar.fields",
|
||||||
"call other.calendar.fields",
|
"call other.calendar.fields",
|
||||||
"get other.day",
|
"get other.day",
|
||||||
|
@ -16,7 +16,27 @@ const customCalendar = {
|
|||||||
},
|
},
|
||||||
toString() {
|
toString() {
|
||||||
TemporalHelpers.assertUnreachable('toString should not be called');
|
TemporalHelpers.assertUnreachable('toString should not be called');
|
||||||
}
|
},
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const date = new Temporal.PlainDate(2000, 5, 2, customCalendar);
|
const date = new Temporal.PlainDate(2000, 5, 2, customCalendar);
|
||||||
[
|
[
|
||||||
|
@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included.
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "2000-05-02[u-ca=iso8601]", "built-in ISO"],
|
[[], "2000-05-02[u-ca=iso8601]", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "2000-05-02[u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "2000-05-02[u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "2000-05-02[u-ca=iso8601]", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "2000-05-02[u-ca=iso8601]", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" should be omitted.
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "2000-05-02", "built-in ISO"],
|
[[], "2000-05-02", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "2000-05-02[u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "2000-05-02[u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "2000-05-02", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "2000-05-02", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -9,12 +9,35 @@ description: >
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "2000-05-02[!u-ca=iso8601]", "built-in ISO"],
|
[[], "2000-05-02[!u-ca=iso8601]", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "2000-05-02[!u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "2000-05-02[!u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "2000-05-02[!u-ca=iso8601]", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "2000-05-02[!u-ca=iso8601]", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "2000-05-02[!u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[!u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "2000-05-02[!u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[!u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -7,12 +7,35 @@ description: If calendarName is "never", the calendar ID should be omitted.
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "2000-05-02", "built-in ISO"],
|
[[], "2000-05-02", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "2000-05-02", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "2000-05-02", "custom"],
|
||||||
[[{ id: "iso8601" }], "2000-05-02", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "2000-05-02", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "2000-05-02", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "2000-05-02", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "2000-05-02", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -14,12 +14,35 @@ info: |
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "2000-05-02", "built-in ISO"],
|
[[], "2000-05-02", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "2000-05-02[u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "2000-05-02[u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "2000-05-02", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "2000-05-02", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "2000-05-02[u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "2000-05-02[u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -17,6 +17,26 @@ features: [Temporal]
|
|||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
id: "custom",
|
id: "custom",
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const date = new Temporal.PlainDate(2000, 5, 2, calendar);
|
const date = new Temporal.PlainDate(2000, 5, 2, calendar);
|
||||||
|
|
||||||
|
@ -8,7 +8,27 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
id: "custom",
|
id: "custom",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const date1 = new Temporal.PlainDate(2000, 5, 2);
|
const date1 = new Temporal.PlainDate(2000, 5, 2);
|
||||||
const date2 = new Temporal.PlainDate(2000, 5, 2, calendar);
|
const date2 = new Temporal.PlainDate(2000, 5, 2, calendar);
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -7,8 +7,52 @@ description: RangeError thrown if calendars' id properties do not match
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const calendar1 = { id: "A" };
|
const calendar1 = {
|
||||||
const calendar2 = { id: "B" };
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "A",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
const calendar2 = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "B",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const plainDate1 = new Temporal.PlainDate(2000, 1, 1, calendar1);
|
const plainDate1 = new Temporal.PlainDate(2000, 1, 1, calendar1);
|
||||||
const plainDate2 = new Temporal.PlainDate(2000, 1, 1, calendar2);
|
const plainDate2 = new Temporal.PlainDate(2000, 1, 1, calendar2);
|
||||||
|
@ -11,6 +11,27 @@ features: [Temporal]
|
|||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalDate
|
// ToTemporalDate
|
||||||
"get other.calendar",
|
"get other.calendar",
|
||||||
|
"has other.calendar.dateAdd",
|
||||||
|
"has other.calendar.dateFromFields",
|
||||||
|
"has other.calendar.dateUntil",
|
||||||
|
"has other.calendar.day",
|
||||||
|
"has other.calendar.dayOfWeek",
|
||||||
|
"has other.calendar.dayOfYear",
|
||||||
|
"has other.calendar.daysInMonth",
|
||||||
|
"has other.calendar.daysInWeek",
|
||||||
|
"has other.calendar.daysInYear",
|
||||||
|
"has other.calendar.fields",
|
||||||
|
"has other.calendar.id",
|
||||||
|
"has other.calendar.inLeapYear",
|
||||||
|
"has other.calendar.mergeFields",
|
||||||
|
"has other.calendar.month",
|
||||||
|
"has other.calendar.monthCode",
|
||||||
|
"has other.calendar.monthDayFromFields",
|
||||||
|
"has other.calendar.monthsInYear",
|
||||||
|
"has other.calendar.weekOfYear",
|
||||||
|
"has other.calendar.year",
|
||||||
|
"has other.calendar.yearMonthFromFields",
|
||||||
|
"has other.calendar.yearOfWeek",
|
||||||
"get other.calendar.fields",
|
"get other.calendar.fields",
|
||||||
"call other.calendar.fields",
|
"call other.calendar.fields",
|
||||||
"get other.day",
|
"get other.day",
|
||||||
|
@ -7,7 +7,29 @@ description: Calendar names are case-insensitive
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
|
const instance = new Temporal.PlainDate(1976, 11, 18, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = "iSo8601";
|
const arg = "iSo8601";
|
||||||
const result = instance.withCalendar(arg);
|
const result = instance.withCalendar(arg);
|
||||||
|
@ -7,7 +7,29 @@ description: A number is converted to a string, then to Temporal.Calendar
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
|
const instance = new Temporal.PlainDate(1976, 11, 18, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = 19761118;
|
const arg = 19761118;
|
||||||
|
|
||||||
|
@ -7,7 +7,29 @@ description: Leap second is a valid ISO string for Calendar
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
|
const instance = new Temporal.PlainDate(1976, 11, 18, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = "2016-12-31T23:59:60";
|
const arg = "2016-12-31T23:59:60";
|
||||||
const result = instance.withCalendar(arg);
|
const result = instance.withCalendar(arg);
|
||||||
|
@ -7,7 +7,29 @@ description: A calendar ID is valid input for Calendar
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
|
const instance = new Temporal.PlainDate(1976, 11, 18, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = "iso8601";
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
@ -31,7 +31,29 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
|
const instance = new Temporal.PlainDate(1976, 11, 18, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
const result = instance.withCalendar(arg);
|
const result = instance.withCalendar(arg);
|
||||||
assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar");
|
assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar");
|
||||||
|
|
||||||
|
@ -9,7 +9,29 @@ description: >
|
|||||||
features: [BigInt, Symbol, Temporal]
|
features: [BigInt, Symbol, Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
|
const instance = new Temporal.PlainDate(1976, 11, 18, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const rangeErrorTests = [
|
const rangeErrorTests = [
|
||||||
[null, "null"],
|
[null, "null"],
|
||||||
@ -17,7 +39,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -26,6 +47,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -15,7 +15,24 @@ const customCalendar = {
|
|||||||
month() { return 2; },
|
month() { return 2; },
|
||||||
monthCode() { return "M02"; },
|
monthCode() { return "M02"; },
|
||||||
day() { return 5; },
|
day() { return 5; },
|
||||||
|
id: "custom-calendar",
|
||||||
toString() { return "custom-calendar"; },
|
toString() { return "custom-calendar"; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
TemporalHelpers.checkSubclassingIgnored(
|
TemporalHelpers.checkSubclassingIgnored(
|
||||||
|
@ -23,6 +23,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -15,7 +15,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [calendar, description] of rangeErrorTests) {
|
for (const [calendar, description] of rangeErrorTests) {
|
||||||
@ -26,8 +25,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.plaindatetime.compare
|
esid: sec-temporal.plaindatetime.compare
|
||||||
description: Calendar is not taken into account for the comparison.
|
description: Calendar is not taken into account for the comparison.
|
||||||
|
includes: [temporalHelpers.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const calendar1 = { toString() { throw new Test262Error("should not call calendar1.toString") } };
|
const calendar1 = TemporalHelpers.calendarThrowEverything();
|
||||||
const calendar2 = { toString() { throw new Test262Error("should not call calendar2.toString") } };
|
const calendar2 = TemporalHelpers.calendarThrowEverything();
|
||||||
const dt1 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar1);
|
const dt1 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar1);
|
||||||
const dt2 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar1);
|
const dt2 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar1);
|
||||||
const dt3 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar1);
|
const dt3 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar1);
|
||||||
|
@ -24,8 +24,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -9,8 +9,29 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
// GetTemporalCalendarWithISODefault
|
// GetTemporalCalendarSlotValueWithISODefault
|
||||||
"get fields.calendar",
|
"get fields.calendar",
|
||||||
|
"has fields.calendar.dateAdd",
|
||||||
|
"has fields.calendar.dateFromFields",
|
||||||
|
"has fields.calendar.dateUntil",
|
||||||
|
"has fields.calendar.day",
|
||||||
|
"has fields.calendar.dayOfWeek",
|
||||||
|
"has fields.calendar.dayOfYear",
|
||||||
|
"has fields.calendar.daysInMonth",
|
||||||
|
"has fields.calendar.daysInWeek",
|
||||||
|
"has fields.calendar.daysInYear",
|
||||||
|
"has fields.calendar.fields",
|
||||||
|
"has fields.calendar.id",
|
||||||
|
"has fields.calendar.inLeapYear",
|
||||||
|
"has fields.calendar.mergeFields",
|
||||||
|
"has fields.calendar.month",
|
||||||
|
"has fields.calendar.monthCode",
|
||||||
|
"has fields.calendar.monthDayFromFields",
|
||||||
|
"has fields.calendar.monthsInYear",
|
||||||
|
"has fields.calendar.weekOfYear",
|
||||||
|
"has fields.calendar.year",
|
||||||
|
"has fields.calendar.yearMonthFromFields",
|
||||||
|
"has fields.calendar.yearOfWeek",
|
||||||
// CalendarFields
|
// CalendarFields
|
||||||
"get fields.calendar.fields",
|
"get fields.calendar.fields",
|
||||||
"call fields.calendar.fields",
|
"call fields.calendar.fields",
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -11,7 +11,28 @@ features: [Temporal]
|
|||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
function makeCalendar(id, objectName) {
|
function makeCalendar(id, objectName) {
|
||||||
const calendar = {};
|
const calendar = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
TemporalHelpers.observeProperty(actual, calendar, "id", id, objectName);
|
TemporalHelpers.observeProperty(actual, calendar, "id", id, objectName);
|
||||||
return calendar;
|
return calendar;
|
||||||
}
|
}
|
||||||
@ -36,10 +57,50 @@ assert.sameValue(dt1.equals(dt3), false, "different calendar string");
|
|||||||
assert.compareArray(actual, ["get calendar1.id", "get calendar3.id"]);
|
assert.compareArray(actual, ["get calendar1.id", "get calendar3.id"]);
|
||||||
|
|
||||||
const calendar4 = {
|
const calendar4 = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
get id() { TemporalHelpers.assertUnreachable('should not get calendar4.id'); },
|
get id() { TemporalHelpers.assertUnreachable('should not get calendar4.id'); },
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const calendar5 = {
|
const calendar5 = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
get id() { TemporalHelpers.assertUnreachable('should not get calendar5.id'); },
|
get id() { TemporalHelpers.assertUnreachable('should not get calendar5.id'); },
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const dt4 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar4);
|
const dt4 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar4);
|
||||||
const dt5 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar4);
|
const dt5 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102, calendar4);
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -8,7 +8,29 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const dt1 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0);
|
const dt1 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0);
|
||||||
const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, { id: "custom" });
|
const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "custom",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
|
@ -11,6 +11,27 @@ features: [Temporal]
|
|||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalDateTime
|
// ToTemporalDateTime
|
||||||
"get other.calendar",
|
"get other.calendar",
|
||||||
|
"has other.calendar.dateAdd",
|
||||||
|
"has other.calendar.dateFromFields",
|
||||||
|
"has other.calendar.dateUntil",
|
||||||
|
"has other.calendar.day",
|
||||||
|
"has other.calendar.dayOfWeek",
|
||||||
|
"has other.calendar.dayOfYear",
|
||||||
|
"has other.calendar.daysInMonth",
|
||||||
|
"has other.calendar.daysInWeek",
|
||||||
|
"has other.calendar.daysInYear",
|
||||||
|
"has other.calendar.fields",
|
||||||
|
"has other.calendar.id",
|
||||||
|
"has other.calendar.inLeapYear",
|
||||||
|
"has other.calendar.mergeFields",
|
||||||
|
"has other.calendar.month",
|
||||||
|
"has other.calendar.monthCode",
|
||||||
|
"has other.calendar.monthDayFromFields",
|
||||||
|
"has other.calendar.monthsInYear",
|
||||||
|
"has other.calendar.weekOfYear",
|
||||||
|
"has other.calendar.year",
|
||||||
|
"has other.calendar.yearMonthFromFields",
|
||||||
|
"has other.calendar.yearOfWeek",
|
||||||
"get other.calendar.fields",
|
"get other.calendar.fields",
|
||||||
"call other.calendar.fields",
|
"call other.calendar.fields",
|
||||||
"get other.day",
|
"get other.day",
|
||||||
|
@ -16,7 +16,27 @@ const customCalendar = {
|
|||||||
},
|
},
|
||||||
toString() {
|
toString() {
|
||||||
TemporalHelpers.assertUnreachable('toString should not be called');
|
TemporalHelpers.assertUnreachable('toString should not be called');
|
||||||
}
|
},
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const date = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, customCalendar);
|
const date = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, customCalendar);
|
||||||
[
|
[
|
||||||
|
@ -7,12 +7,35 @@ description: If calendarName is "always", the calendar ID should be included.
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "1976-11-18T15:23:00[u-ca=iso8601]", "built-in ISO"],
|
[[], "1976-11-18T15:23:00[u-ca=iso8601]", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "1976-11-18T15:23:00[u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "1976-11-18T15:23:00[u-ca=iso8601]", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=iso8601]", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -7,12 +7,35 @@ description: If calendarName is "auto", "iso8601" should be omitted.
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "1976-11-18T15:23:00", "built-in ISO"],
|
[[], "1976-11-18T15:23:00", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "1976-11-18T15:23:00[u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "1976-11-18T15:23:00", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -9,12 +9,35 @@ description: >
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "1976-11-18T15:23:00[!u-ca=iso8601]", "built-in ISO"],
|
[[], "1976-11-18T15:23:00[!u-ca=iso8601]", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "1976-11-18T15:23:00[!u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "1976-11-18T15:23:00[!u-ca=iso8601]", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=iso8601]", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "1976-11-18T15:23:00[!u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[!u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[!u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -7,12 +7,35 @@ description: If calendarName is "never", the calendar ID should be omitted.
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "1976-11-18T15:23:00", "built-in ISO"],
|
[[], "1976-11-18T15:23:00", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "1976-11-18T15:23:00", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00", "custom"],
|
||||||
[[{ id: "iso8601" }], "1976-11-18T15:23:00", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "1976-11-18T15:23:00", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "1976-11-18T15:23:00", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -14,12 +14,35 @@ info: |
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
const calendarMethods = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
};
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
[[], "1976-11-18T15:23:00", "built-in ISO"],
|
[[], "1976-11-18T15:23:00", "built-in ISO"],
|
||||||
[[{ id: "custom" }], "1976-11-18T15:23:00[u-ca=custom]", "custom"],
|
[[{ id: "custom", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=custom]", "custom"],
|
||||||
[[{ id: "iso8601" }], "1976-11-18T15:23:00", "custom with iso8601 id"],
|
[[{ id: "iso8601", ...calendarMethods }], "1976-11-18T15:23:00", "custom with iso8601 id"],
|
||||||
[[{ id: "ISO8601" }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"],
|
[[{ id: "ISO8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=ISO8601]", "custom with caps id"],
|
||||||
[[{ id: "\u0131so8601" }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"],
|
[[{ id: "\u0131so8601", ...calendarMethods }], "1976-11-18T15:23:00[u-ca=\u0131so8601]", "custom with dotless i id"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [args, expected, description] of tests) {
|
for (const [args, expected, description] of tests) {
|
||||||
|
@ -17,6 +17,26 @@ features: [Temporal]
|
|||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
id: "custom",
|
id: "custom",
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
|
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
|
||||||
|
|
||||||
|
@ -8,7 +8,27 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
id: "custom",
|
id: "custom",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const datetime1 = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0);
|
const datetime1 = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0);
|
||||||
const datetime2 = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0, calendar);
|
const datetime2 = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 650, 0, calendar);
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -8,7 +8,29 @@ features: [Temporal]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const dt1 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0);
|
const dt1 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0);
|
||||||
const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, { id: "custom" });
|
const dt2 = new Temporal.PlainDateTime(2000, 1, 1, 0, 0, 0, 0, 0, 0, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "custom",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
RangeError,
|
RangeError,
|
||||||
|
@ -11,6 +11,27 @@ features: [Temporal]
|
|||||||
const expected = [
|
const expected = [
|
||||||
// ToTemporalDateTime
|
// ToTemporalDateTime
|
||||||
"get other.calendar",
|
"get other.calendar",
|
||||||
|
"has other.calendar.dateAdd",
|
||||||
|
"has other.calendar.dateFromFields",
|
||||||
|
"has other.calendar.dateUntil",
|
||||||
|
"has other.calendar.day",
|
||||||
|
"has other.calendar.dayOfWeek",
|
||||||
|
"has other.calendar.dayOfYear",
|
||||||
|
"has other.calendar.daysInMonth",
|
||||||
|
"has other.calendar.daysInWeek",
|
||||||
|
"has other.calendar.daysInYear",
|
||||||
|
"has other.calendar.fields",
|
||||||
|
"has other.calendar.id",
|
||||||
|
"has other.calendar.inLeapYear",
|
||||||
|
"has other.calendar.mergeFields",
|
||||||
|
"has other.calendar.month",
|
||||||
|
"has other.calendar.monthCode",
|
||||||
|
"has other.calendar.monthDayFromFields",
|
||||||
|
"has other.calendar.monthsInYear",
|
||||||
|
"has other.calendar.weekOfYear",
|
||||||
|
"has other.calendar.year",
|
||||||
|
"has other.calendar.yearMonthFromFields",
|
||||||
|
"has other.calendar.yearOfWeek",
|
||||||
"get other.calendar.fields",
|
"get other.calendar.fields",
|
||||||
"call other.calendar.fields",
|
"call other.calendar.fields",
|
||||||
"get other.day",
|
"get other.day",
|
||||||
|
@ -9,7 +9,28 @@ includes: [temporalHelpers.js]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
toString() { return "something special"; }
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "something special",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
toString() { return "something special"; },
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const dt = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar);
|
const dt = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, calendar);
|
||||||
const result = dt.withCalendar("iso8601");
|
const result = dt.withCalendar("iso8601");
|
||||||
|
@ -7,7 +7,29 @@ description: Calendar names are case-insensitive
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
|
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = "iSo8601";
|
const arg = "iSo8601";
|
||||||
const result = instance.withCalendar(arg);
|
const result = instance.withCalendar(arg);
|
||||||
|
@ -7,7 +7,29 @@ description: A number is converted to a string, then to Temporal.Calendar
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
|
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = 19761118;
|
const arg = 19761118;
|
||||||
|
|
||||||
|
@ -7,7 +7,29 @@ description: Leap second is a valid ISO string for Calendar
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
|
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = "2016-12-31T23:59:60";
|
const arg = "2016-12-31T23:59:60";
|
||||||
const result = instance.withCalendar(arg);
|
const result = instance.withCalendar(arg);
|
||||||
|
@ -7,7 +7,29 @@ description: A calendar ID is valid input for Calendar
|
|||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
|
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const arg = "iso8601";
|
const arg = "iso8601";
|
||||||
|
|
||||||
|
@ -31,7 +31,29 @@ const zonedDateTime = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UT
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
|
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
const result = instance.withCalendar(arg);
|
const result = instance.withCalendar(arg);
|
||||||
assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar");
|
assert.sameValue(result.getISOFields().calendar, calendar, "Temporal object coerced to calendar");
|
||||||
|
|
||||||
|
@ -9,7 +9,29 @@ description: >
|
|||||||
features: [BigInt, Symbol, Temporal]
|
features: [BigInt, Symbol, Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
|
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, {
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
id: "replace-me",
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
|
});
|
||||||
|
|
||||||
const rangeErrorTests = [
|
const rangeErrorTests = [
|
||||||
[null, "null"],
|
[null, "null"],
|
||||||
@ -17,7 +39,6 @@ const rangeErrorTests = [
|
|||||||
["", "empty string"],
|
["", "empty string"],
|
||||||
[1, "number that doesn't convert to a valid ISO string"],
|
[1, "number that doesn't convert to a valid ISO string"],
|
||||||
[1n, "bigint"],
|
[1n, "bigint"],
|
||||||
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of rangeErrorTests) {
|
for (const [arg, description] of rangeErrorTests) {
|
||||||
@ -26,6 +47,9 @@ for (const [arg, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const [arg, description] of typeErrorTests) {
|
for (const [arg, description] of typeErrorTests) {
|
||||||
|
@ -15,7 +15,24 @@ const customCalendar = {
|
|||||||
month() { return 2; },
|
month() { return 2; },
|
||||||
monthCode() { return "M02"; },
|
monthCode() { return "M02"; },
|
||||||
day() { return 5; },
|
day() { return 5; },
|
||||||
|
id: "custom-calendar",
|
||||||
toString() { return "custom-calendar"; },
|
toString() { return "custom-calendar"; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
TemporalHelpers.checkSubclassingIgnored(
|
TemporalHelpers.checkSubclassingIgnored(
|
||||||
|
@ -16,7 +16,23 @@ const cal = {
|
|||||||
year() { return 2008; },
|
year() { return 2008; },
|
||||||
month() { return 9; },
|
month() { return 9; },
|
||||||
monthCode() { return "M09"; },
|
monthCode() { return "M09"; },
|
||||||
day() { return 6; }
|
day() { return 6; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0);
|
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0);
|
||||||
assert.sameValue(pdt.calendarId, "iso8601", "PlainDateTime with ISO calendar");
|
assert.sameValue(pdt.calendarId, "iso8601", "PlainDateTime with ISO calendar");
|
||||||
|
@ -10,7 +10,27 @@ includes: [temporalHelpers.js]
|
|||||||
|
|
||||||
const cal1 = {
|
const cal1 = {
|
||||||
id: "this is a string",
|
id: "this is a string",
|
||||||
toString() { return "this is another string"; }
|
toString() { return "this is another string"; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
day() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
month() {},
|
||||||
|
monthCode() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
year() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const cal2 = {
|
const cal2 = {
|
||||||
id: "this is a string",
|
id: "this is a string",
|
||||||
@ -20,7 +40,23 @@ const cal2 = {
|
|||||||
year() { return 2008; },
|
year() { return 2008; },
|
||||||
month() { return 9; },
|
month() { return 9; },
|
||||||
monthCode() { return "M09"; },
|
monthCode() { return "M09"; },
|
||||||
day() { return 6; }
|
day() { return 6; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal1);
|
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal1);
|
||||||
const pd = new Temporal.PlainDate(2010, 11, 12, cal2);
|
const pd = new Temporal.PlainDate(2010, 11, 12, cal2);
|
||||||
|
@ -20,7 +20,23 @@ const cal = {
|
|||||||
year() { return 2008; },
|
year() { return 2008; },
|
||||||
month() { return 9; },
|
month() { return 9; },
|
||||||
monthCode() { return "M09"; },
|
monthCode() { return "M09"; },
|
||||||
day() { return 6; }
|
day() { return 6; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal);
|
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal);
|
||||||
const pd = new Temporal.PlainDate(2010, 11, 12, cal);
|
const pd = new Temporal.PlainDate(2010, 11, 12, cal);
|
||||||
|
@ -16,7 +16,23 @@ const cal = {
|
|||||||
year() { return 2008; },
|
year() { return 2008; },
|
||||||
month() { return 9; },
|
month() { return 9; },
|
||||||
monthCode() { return "M09"; },
|
monthCode() { return "M09"; },
|
||||||
day() { return 6; }
|
day() { return 6; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal);
|
const pdt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal);
|
||||||
const pd = new Temporal.PlainDate(2010, 11, 12);
|
const pd = new Temporal.PlainDate(2010, 11, 12);
|
||||||
|
@ -27,8 +27,9 @@ for (const [calendar, description] of rangeErrorTests) {
|
|||||||
|
|
||||||
const typeErrorTests = [
|
const typeErrorTests = [
|
||||||
[Symbol(), "symbol"],
|
[Symbol(), "symbol"],
|
||||||
[{}, "plain object"], // TypeError due to missing dateFromFields()
|
[{}, "plain object that doesn't implement the protocol"],
|
||||||
[Temporal.Calendar, "Temporal.Calendar, object"], // ditto
|
[new Temporal.TimeZone("UTC"), "time zone instance"],
|
||||||
|
[Temporal.Calendar, "Temporal.Calendar, object"],
|
||||||
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
[Temporal.Calendar.prototype, "Temporal.Calendar.prototype, object"], // fails brand check in dateFromFields()
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -16,7 +16,23 @@ const cal = {
|
|||||||
year() { return 2008; },
|
year() { return 2008; },
|
||||||
month() { return 9; },
|
month() { return 9; },
|
||||||
monthCode() { return "M09"; },
|
monthCode() { return "M09"; },
|
||||||
day() { return 6; }
|
day() { return 6; },
|
||||||
|
dateAdd() {},
|
||||||
|
dateFromFields() {},
|
||||||
|
dateUntil() {},
|
||||||
|
dayOfWeek() {},
|
||||||
|
dayOfYear() {},
|
||||||
|
daysInMonth() {},
|
||||||
|
daysInWeek() {},
|
||||||
|
daysInYear() {},
|
||||||
|
fields() {},
|
||||||
|
inLeapYear() {},
|
||||||
|
mergeFields() {},
|
||||||
|
monthDayFromFields() {},
|
||||||
|
monthsInYear() {},
|
||||||
|
weekOfYear() {},
|
||||||
|
yearMonthFromFields() {},
|
||||||
|
yearOfWeek() {},
|
||||||
};
|
};
|
||||||
const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal);
|
const dt = new Temporal.PlainDateTime(1995, 12, 7, 3, 24, 30, 0, 0, 0, cal);
|
||||||
const shifted = dt.withPlainDate("2010-11-12");
|
const shifted = dt.withPlainDate("2010-11-12");
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user