fix(set): clamp hour() to 23 instead of the invalid 24

hour(n) with n >= 24 clamped n to 24, which walkTo() rejects as an invalid
hour (valid range 0-23), nulling the epoch and invalidating the object.
Clamp to 23 to match the other overflow-clamping setters (date, month).
This commit is contained in:
dualfroz committed 2026-09-06 01:13:18 +02:00
1 parent 96f6f12e4e
commit bf7f44c584
3 files changed
+15 -40

No files matched your search

+2 -1
View File
@@ -67,8 +67,9 @@ const minutes = function (s, n, goFwd) {
const hours = function (s, n, goFwd) {
n = validate(n)
// Clamp to 0-23: hour 24 is rejected by walkTo(), which nulls the epoch.
if (n >= 24) {
n = 24
n = 23
} else if (n < 0) {
n = 0
}