mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
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:
parent
b94307583b
commit
f7517c5b8d
Notes:
github-actions[bot]
2024-11-21 00:06:58 +00:00
Author: https://github.com/trflynn89
Commit: f7517c5b8d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2431
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/shannonbooth ✅
386 changed files with 8 additions and 33007 deletions
|
@ -1,44 +0,0 @@
|
|||
describe("correct behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Temporal.Now.plainTimeISO).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
const plainTime = Temporal.Now.plainTimeISO();
|
||||
expect(plainTime).toBeInstanceOf(Temporal.PlainTime);
|
||||
expect(plainTime.calendar.id).toBe("iso8601");
|
||||
});
|
||||
|
||||
test("custom time zone", () => {
|
||||
const timeZone = {
|
||||
getOffsetNanosecondsFor() {
|
||||
return 86399999999999;
|
||||
},
|
||||
};
|
||||
const plainTime = Temporal.Now.plainTimeISO("UTC");
|
||||
const plainTimeWithOffset = Temporal.Now.plainTimeISO(timeZone);
|
||||
// FIXME: Compare these in a sensible way
|
||||
});
|
||||
|
||||
test("cannot have a time zone with more than a day", () => {
|
||||
[86400000000000, -86400000000000, 86400000000001, 86400000000002].forEach(offset => {
|
||||
const timeZone = {
|
||||
getOffsetNanosecondsFor() {
|
||||
return offset;
|
||||
},
|
||||
};
|
||||
expect(() => Temporal.Now.plainTimeISO(timeZone)).toThrowWithMessage(
|
||||
RangeError,
|
||||
"Invalid offset nanoseconds value, must be in range -86400 * 10^9 + 1 to 86400 * 10^9 - 1"
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainTimeISO({});
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue