Fix day of the week calculation (#1443)

This commit is contained in:
Lennart Ochel
2025-06-26 20:15:46 +02:00
committed by GitHub
parent c448639245
commit 035077679d
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ export const osApi = new LuaTable({
// Day of the week
"%A": () => date.toLocaleString("en-US", { weekday: "long" }),
"%a": () => date.toLocaleString("en-US", { weekday: "short" }),
"%w": () => "" + (date.getDay() + 1),
"%w": () => "" + date.getDay(),
// Day of the year
"%j": () => {
return dayOfYear(date).toString().padStart(3, "0");
+2
View File
@@ -20,3 +20,5 @@ assert(os.date("%U %V %W", os.time({ year = 2025, month = 1, day = 5 })) == "01
assert(os.date("%U %V %W", os.time({ year = 2025, month = 1, day = 6 })) == "01 02 01")
assert(os.date("%U %V %W", os.time({ year = 2025, month = 1, day = 7 })) == "01 02 01")
assert(os.date("%U %V %W", os.time({ year = 2025, month = 5, day = 3 })) == "17 18 17")
assert(os.date("%w", 1750672800) == "1")