diff --git a/lib/space_lua/stdlib/os.ts b/lib/space_lua/stdlib/os.ts index 3279ef2b..1b2ddc76 100644 --- a/lib/space_lua/stdlib/os.ts +++ b/lib/space_lua/stdlib/os.ts @@ -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"); diff --git a/lib/space_lua/stdlib/os_test.lua b/lib/space_lua/stdlib/os_test.lua index 6f8b0652..8fee0d64 100644 --- a/lib/space_lua/stdlib/os_test.lua +++ b/lib/space_lua/stdlib/os_test.lua @@ -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")