From 83526ce0746dfdd6e6235ad30a5549cd56c0347b Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Sun, 2 Jan 2022 14:50:38 +0100 Subject: [PATCH] fix #53 --- lua/telekasten.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 144eabc..6a71285 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -299,8 +299,8 @@ local function calculate_dates(date) -- would appear as being in 2022-W52. That breaks linear linking respective -- of next/prev week, so we want to put the days of that partial week in -- January in 2021-W52. This tweak will only change the ISO formatted week string. - if dates.week == 52 and dates.month == 1 then - dates.isoweek = os.date(df.isoweek, time - oneyear) + if tonumber(dates.week) == 52 and tonumber(dates.month) == 1 then + dates.isoweek = tostring(dates.year - 1) .. "-W52" end -- Find the Sunday that started this week regardless of the calendar @@ -2101,7 +2101,8 @@ local function GotoThisWeek(opts) opts.close_after_yanking = opts.close_after_yanking or M.Cfg.close_after_yanking - local title = os.date(dateformats.isoweek) + local dinfo = calculate_dates() + local title = dinfo.isoweek local fname = M.Cfg.weeklies .. "/" .. title .. M.Cfg.extension local fexists = file_exists(fname) if