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