1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

LibJS/Tests: Fix Temporal.Now.plainDateTime{,ISO}() epoch calculation

Combining month and day like this doesn't always yield correct results.
Use dayOfYear multiplied by the seconds per day instead, which does.
This commit is contained in:
Linus Groh 2021-07-31 13:54:08 +01:00
parent cab1015a03
commit 95331ea864
2 changed files with 2 additions and 4 deletions

View file

@ -20,8 +20,7 @@ describe("correct behavior", () => {
const plainDateTimeToEpochSeconds = plainDateTime =>
(plainDateTime.year - 1970) * 31_556_952 +
plainDateTime.month * 2_630_000 +
plainDateTime.day * 86_400 +
plainDateTime.dayOfYear * 86_400 +
plainDateTime.hour * 3_600 +
plainDateTime.minute * 60 +
plainDateTime.second +