From 626b8006763a6d960c1ed751f49aac1873f4a34b Mon Sep 17 00:00:00 2001 From: Liquidmantis Date: Sat, 11 Dec 2021 09:33:21 -0700 Subject: [PATCH] add iso formatted week tokens --- README.md | 3 +++ lua/telekasten.lua | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index d330e54..fb648e3 100644 --- a/README.md +++ b/README.md @@ -633,6 +633,9 @@ Currently, the following substitutions will be made during new note creation: | `{{week}}` | week of the year | 46 | | `{{lastweek}}` | prior week of the year | 45 | | `{{nextweek}}` | next week of the year | 47 | +| `{{isoweek}}` | week of the year in iso format | 2021-W46 | +| `{{lastisoweek}}` | prior week of the year in iso format | 2021-W45 | +| `{{nextisoweek}}` | next week of the year in iso format| 2021-W47 | | `{{year}}` | year | 2021 | As an example, this is my template for new notes: diff --git a/lua/telekasten.lua b/lua/telekasten.lua index cfe49fd..fcde40d 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -203,6 +203,7 @@ local function calenderinfo_today() local oneweek = 7 * oneday local date_format = "%Y-%m-%d" local week_format = "%V" + local isoweek_format = "%Y-W%V" local opts = {} opts.date = os.date(date_format) opts.yesterday = os.date(date_format, os.time() - oneday) @@ -225,6 +226,9 @@ local function calenderinfo_today() opts.week = os.date(week_format) opts.lastweek = os.date(week_format, os.time() - oneweek) opts.nextweek = os.date(week_format, os.time() + oneweek) + opts.week = os.date(isoweek_format) + opts.lastisoweek = os.date(isoweek_format, os.time() - oneweek) + opts.nextisoweek = os.date(isoweek_format, os.time() + oneweek) opts.month = dinfo.month opts.year = dinfo.year opts.day = dinfo.day