LibJS: Remove our existing Temporal implementation

Our Temporal implementation is woefully out of date. The spec has been
so vastly rewritten that it is unfortunately not practical to update our
implementation in-place. Even just removing Temporal objects that were
removed from the spec, or updating any of the simpler remaining objects,
has proven to be a mess in previous attempts.

So, this removes our Temporal implementation. AOs used by other specs
are left intact.
This commit is contained in:
Timothy Flynn 2024-11-16 12:51:53 -05:00 committed by Tim Flynn
commit f7517c5b8d
Notes: github-actions[bot] 2024-11-21 00:06:58 +00:00
386 changed files with 8 additions and 33007 deletions

View file

@ -1,53 +0,0 @@
describe("errors", () => {
test("called without new", () => {
expect(() => {
Temporal.PlainDateTime();
}).toThrowWithMessage(
TypeError,
"Temporal.PlainDateTime constructor must be called with 'new'"
);
});
test("cannot pass Infinity", () => {
for (let i = 0; i < 9; ++i) {
const args = Array(9).fill(0);
args[i] = Infinity;
expect(() => {
new Temporal.PlainDateTime(...args);
}).toThrowWithMessage(RangeError, "Invalid plain date time");
args[i] = -Infinity;
expect(() => {
new Temporal.PlainDateTime(...args);
}).toThrowWithMessage(RangeError, "Invalid plain date time");
}
});
test("cannot pass invalid ISO date or time", () => {
// NOTE: The year max value is 3 more than in the polyfill, but they incorrectly seem to
// use ISOYearMonthWithinLimits, which AFAICT isn't used for PlainDate{,Time} in the spec.
// ¯\_(ツ)_/¯
const badValues = [275764, 0, 0, 24, 60, 60, 1000, 1000, 1000];
for (let i = 0; i < 9; ++i) {
const args = [0, 1, 1, 0, 0, 0, 0, 0, 0];
args[i] = badValues[i];
expect(() => {
new Temporal.PlainDateTime(...args);
}).toThrowWithMessage(RangeError, "Invalid plain date time");
}
});
});
describe("normal behavior", () => {
test("length is 3", () => {
expect(Temporal.PlainDateTime).toHaveLength(3);
});
test("basic functionality", () => {
const plainDateTime = new Temporal.PlainDateTime(2021, 7, 22, 19, 46, 32, 123, 456, 789);
expect(typeof plainDateTime).toBe("object");
expect(plainDateTime).toBeInstanceOf(Temporal.PlainDateTime);
expect(Object.getPrototypeOf(plainDateTime)).toBe(Temporal.PlainDateTime.prototype);
});
});