Sorry to ask this question but I getting crazy here…
I am working on my daily, weekly, monthly notes and I have a strange issue with the templater plugin:
We are in calender week 3 now and this line in the frontmatter…
Do you have the file names of those examples? If you look at tp.date - Templater, you’ll see that you’re trying to lock the date for that format string from the file name.
OK, so I’ve condensed your issue down into this template:
## Original
<% tp.date.now("YYYY-[W]ww", 0, "2023-W03", "YYYY-MM-DD") %>
## Modified reference format
<% tp.date.now("YYYY-MM-DD", 0, "2023-W03", "YYYY-[W]ww") %>
Which produces this output:
The point is that in the first line it’s to be understood as:
Function call of tp.date.now(): Until further notice lets work with todays date
First parameter: Display whatever date we’re using according to this format: “YYYY-[W]ww”
Second parameter: Offset the date we’re working with by this much, 0 meaning no offset
Third parameter: By the way, we don’t want to use today, but we want to use the date referenced here. (In my text example, the fixed value of “2023-W03” (and in your case the file name)
Fourth parameter: AND the date in the third parameter, follows this date format
In other words, you’re asking Templater to understand “2023-W03” as if it was written as “YYYY-MM-DD” whilst it clearly is not in that format. This confuses Templater so much, and in an effort to give you some result it interprets this as the date “2023-03-01”, which in fact is in “W09”.
In the second line, I tell Templater to interpret it as the format it is in, and it reports back the date of that week, which is the first day of that week.
If you specify an alternative date, like with tp.file.title, you need to specify which date format that file title has in the fourth parameter.
A question for you though, if the file title already is in the format YYYY-[W]ww, then why do you convert into a date to report it back in the same format as it was? Wouldn’t it be easier just to do: