mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
LibJS: Fix modulo in get_iso_parts_from_epoch() for negative epoch ns
This now matches the spec change from reminder() to modulo which was
done here: bdf60f5
This commit is contained in:
parent
61410e05eb
commit
c56e5139f5
2 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,12 @@ describe("correct behavior", () => {
|
|||
expect(zonedDateTime.toString()).toBe("2021-11-03T01:33:05.1002003+00:00[UTC]");
|
||||
});
|
||||
|
||||
test("negative epoch nanoseconds", () => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(-999_999_999n, timeZone);
|
||||
expect(zonedDateTime.toString()).toBe("1969-12-31T23:59:59.000000001+00:00[UTC]");
|
||||
});
|
||||
|
||||
test("fractionalSecondDigits option", () => {
|
||||
const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300);
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue