LibJS: Begin implementing the relativeTo option of Duration.round

This commit is contained in:
Timothy Flynn 2024-11-22 18:16:57 -05:00 committed by Andreas Kling
commit 70ad66d3c0
Notes: github-actions[bot] 2024-11-23 13:47:01 +00:00
6 changed files with 219 additions and 9 deletions

View file

@ -89,6 +89,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.round({ largestUnit: "months", relativeTo });
expect(result.months).toBe(1);
});
});
});
describe("errors", () => {