Templater: include link to next and last week

Hi everyone,

I am still trying to figure out how to link to next and previous week

The syntax for days and month is working:

**yesterday** [[<% tp.date.now("YYYY-MM-DD (ddd)", -1, tp.file.title, "YYYY-MM-DD (ddd)") %>]] | **tomorrow** [[<% tp.date.now("YYYY-MM-DD (ddd)", 1, tp.file.title, "YYYY-MM-DD (ddd)") %>]]

**this month** [[<% tp.date.now("YYYY-MM-MMMM", " ", tp.file.title, "YYYY-MM-MMMM") %>]] | [[<% tp.date.now("YYYY-MM-MMMM", "P-1M", tp.file.title, "YYYY-MM-MMMM") %>]] | [[<% tp.date.now("YYYY-MM-MMMM", "P1M", tp.file.title, "YYYY-MM-MMMM") %>]]

But I can’t get links to the next and previous week to work.
(KW is just an abbreviation, it means calendarweek)

next week [[<% tp.date.now("YYYY [KW] WW", 1, tp.file.title, "YYYY [KW] WW") %>]]
previous week [[<% tp.date.now("YYYY [KW] WW", -1, tp.file.title, "YYYY [KW] WW") %>]]

Any idea what I am missing?
Thanks for any help!

I’m not, at all, fluent in Templater. But, as in month (“P-1M”, “P1M”), did you try with the designator “W” (to week) in “P” (for period duration), i.e, “P-1W”, “P1W”?

Thanks for the advice! It renders wrong numbers, but I don’ t know why.

We have Week 02 now. I tried

next Week: [[<% tp.date.now(“YYYY [KW] WW”, “P1W”, tp.file.title, “YYYY [KW] WW”) %>]]
previous week: [[<% tp.date.now(“YYYY [KW] WW”, “P-1W”, tp.file.title, “YYYY [KW] WW”) %>]]

will return
next Week: [[2022 KW 01]] (instead of Week 03)
previous week: [[2021 KW 51]] (instead of Week 01)

So figured out the week issue - but still there are problems when using all the code on one page. I opened a new topic for this, that gives a better overview. Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.