Skip to content

Commit

Permalink
fix(calendar): call os.date twice to generate correct weekday (#1058)
Browse files Browse the repository at this point in the history
fixes #1059
  • Loading branch information
champignoom committed Sep 8, 2023
1 parent 63a7a10 commit 61fb605
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lua/neorg/modules/core/tempus/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,14 @@ module.public = {
---@param parsed_date Date #The date to convert
---@return osdate #A Lua date
to_lua_date = function(parsed_date)
return vim.tbl_deep_extend("force", os.date("*t"), {
return os.date("*t", os.time(vim.tbl_deep_extend("force", os.date("*t"), {
day = parsed_date.day,
month = parsed_date.month and parsed_date.month.number or nil,
year = parsed_date.year,
hour = parsed_date.time and parsed_date.time.hour,
min = parsed_date.time and parsed_date.time.minute,
sec = parsed_date.time and parsed_date.time.second,
wday = parsed_date.weekday and lib.number_wrap(parsed_date.weekday.number + 1, 1, 7),
})
})))
end,

--- Converts a lua `osdate` to a Neorg date.
Expand Down

0 comments on commit 61fb605

Please sign in to comment.