aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/loslib.js2
-rw-r--r--test/loslib.test.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/loslib.js b/src/loslib.js
index cc43e3b..b58b368 100644
--- a/src/loslib.js
+++ b/src/loslib.js
@@ -75,7 +75,7 @@ const setallfields = function(L, time, utc) {
setfield(L, "day", utc ? time.getUTCDate() : time.getDate());
setfield(L, "month", (utc ? time.getUTCMonth() : time.getMonth()) + 1);
setfield(L, "year", utc ? time.getUTCFullYear() : time.getFullYear());
- setfield(L, "wday", utc ? time.getUTCDay() : time.getDay());
+ setfield(L, "wday", (utc ? time.getUTCDay() : time.getDay()) + 1);
let now = new Date();
setfield(L, "yday", Math.floor((now - (new Date(now.getFullYear(), 0, 0))) / (1000 * 60 * 60 * 24)));
// setboolfield(L, "isdst", time.get);
diff --git a/test/loslib.test.js b/test/loslib.test.js
index abb5ef2..02735cb 100644
--- a/test/loslib.test.js
+++ b/test/loslib.test.js
@@ -119,6 +119,7 @@ test('os.time normalisation of table', () => {
assert(t.day == 20, "unmodified day")
assert(t.month == 2, "unmodified month")
assert(t.year == 2018, "unmodified year")
+ assert(t.wday == 3, "correct wday")
`;
lualib.luaL_openlibs(L);
expect(lauxlib.luaL_loadstring(L, to_luastring(luaCode))).toBe(lua.LUA_OK);