I am building a template with templater plugin and periodic dates plugin.
Goal:
I want four blocks with links to the respective pages in my template:
a) [yesterday] | [today] | [tomorrow]
b) [the week before] | [this week] | [next week]
c) [the month before] | [this month] | [next month]
d) [link to the date, that actually is right now]
On the pages, it should look like this
[2022-01-10 (Mo.)] | [2022-01-11 (Di.)] | [2022-01-12 (Mi.)]
[2022-01-01] [2022-01-02]| [2022-01-02] | [2022-01-03]
[2021-12-Dezember] | [2022-01-Januar] | [2022-02-Februar]
[2022-01-11 (Di.)]
I think, this is really a nice way to navigate and maybe someone else also finds this code useful. To achieve this, I use the following code in the template:
a)
[[<% tp.date.now(“YYYY-MM-DD (ddd)”, -1, tp.file.title, “YYYY-MM-DD (ddd)”) %>]]
[[<% tp.date.now(“YYYY-MM-DD (ddd)”, 0, tp.file.title, “YYYY-MM-DD (ddd)”) %>]]
[[<% tp.date.now(“YYYY-MM-DD (ddd)”, 1, tp.file.title, “YYYY-MM-DD (ddd)”) %>]]
b)
[[<% tp.date.now(“YYYY [KW] WW”, “P-1W”, tp.file.title, “YYYY [KW] WW”) %>]]
[[<% tp.date.now(“YYYY [KW] WW”, “”, tp.file.title, “YYYY [KW] WW”) %>]]
[[<% tp.date.now(“YYYY [KW] WW”, “P1W”, tp.file.title, “YYYY [KW] WW”) %>]]
c)
[[<% tp.date.now(“YYYY-MM-MMMM”, “P-1M”, tp.file.title, “YYYY-MM-MMMM”) %>]]
[[<% tp.date.now(“YYYY-MM-MMMM”, “”, tp.file.title, “YYYY-MM-MMMM”) %>]]
[[<% tp.date.now(“YYYY-MM-MMMM”, “P1M”, tp.file.title, “YYYY-MM-MMMM”) %>]]
d)
[[<% tp.date.now(“YYYY-MM-DD (ddd)”) %>]]
It finally all worked out - except for the month where I get wrong results:
[[2021 KW 51]] → should be [[2022 KW 01]]
[[2022 KW 52]] → should be [[2022 KW 02]]
[[2022 KW 01]] → should be [[2022 KW 03]]
And now the strange thing: if I ONLY put this code (c) in a template, it works out correctly! – Together with the rest of the code, it doesn’t.
Can anybody help me to get this right? I just can’t figure out what to do next.