LibJS: Begin implementing the relativeTo option of Duration.total

This commit is contained in:
Timothy Flynn 2024-11-22 18:38:53 -05:00 committed by Andreas Kling
commit d0149d8fc0
Notes: github-actions[bot] 2024-11-23 13:46:56 +00:00
6 changed files with 89 additions and 18 deletions

View file

@ -16,6 +16,15 @@ describe("correct behavior", () => {
}
}
});
test("relative to plain date", () => {
const duration = new Temporal.Duration(0, 0, 0, 31);
["2000-01-01", "2000-01-01T00:00", "2000-01-01T00:00[u-ca=iso8601]"].forEach(relativeTo => {
const result = duration.total({ unit: "months", relativeTo });
expect(result).toBe(1);
});
});
});
describe("errors", () => {