summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-31 13:54:08 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-31 13:54:25 +0100
commit95331ea86475d2d2131ef42e8bf9f07803425676 (patch)
tree6e6742d7b8b87d0ce73d7ef4cdfcc841e3a66951 /Userland/Libraries
parentcab1015a03c3f7db042507e3d5ee7edde8c079b5 (diff)
downloadserenity-95331ea86475d2d2131ef42e8bf9f07803425676.zip
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTime.js3
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTimeISO.js3
2 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTime.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTime.js
index 0ff22d80ff..7639283295 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTime.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTime.js
@@ -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 +
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTimeISO.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTimeISO.js
index 9fd61584bb..63eab85628 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTimeISO.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/Now/Now.plainDateTimeISO.js
@@ -18,8 +18,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 +