1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:27:35 +00:00

LibJS: Implement Temporal.Calendar.prototype.dateAdd()

This commit is contained in:
Linus Groh 2021-08-30 20:44:05 +01:00
parent f492e98f19
commit e3254bf4c5
6 changed files with 94 additions and 0 deletions

View file

@ -0,0 +1,15 @@
describe("correct behavior", () => {
test("length is 3", () => {
expect(Temporal.Calendar.prototype.dateAdd).toHaveLength(3);
});
test("basic functionality", () => {
const calendar = new Temporal.Calendar("iso8601");
const plainDate = new Temporal.PlainDate(1970, 1, 1);
const duration = new Temporal.Duration(1, 2, 3, 4);
const newPlainDate = calendar.dateAdd(plainDate, duration);
expect(newPlainDate.year).toBe(1971);
expect(newPlainDate.month).toBe(3);
expect(newPlainDate.day).toBe(26);
});
});