mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
LibJS: Begin implementing the relativeTo option of Duration.round
This commit is contained in:
parent
0befd52725
commit
70ad66d3c0
Notes:
github-actions[bot]
2024-11-23 13:47:01 +00:00
Author: https://github.com/trflynn89
Commit: 70ad66d3c0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2513
Reviewed-by: https://github.com/shannonbooth ✅
6 changed files with 219 additions and 9 deletions
|
@ -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", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue