LibJS: Implement Date.prototype.toTemporalInstant

This commit is contained in:
Timothy Flynn 2024-11-26 10:51:45 -05:00 committed by Tim Flynn
commit 511029807a
Notes: github-actions[bot] 2024-11-26 21:57:38 +00:00
4 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,15 @@
describe("correct behavior", () => {
test("basic functionality", () => {
const date = new Date("2021-07-09T01:36:00Z");
const instant = date.toTemporalInstant();
expect(instant.epochMilliseconds).toBe(1625794560000);
});
});
describe("errors", () => {
test("this value must be a Date object", () => {
expect(() => {
Date.prototype.toTemporalInstant.call(123);
}).toThrowWithMessage(TypeError, "Not an object of type Date");
});
});