With
[[Journal/Daily/<%moment(tp.file.title).format(“YYYY”)%>/<%moment(tp.file.title).format(“MM”)%>/<%moment(tp.file.title).add(0,‘day’).format(“YYYY-MM-DD-dddd”)%>|Monday]]
So a file example is: Journal/Daily/2024/02/2024-02-05-Monday
But get a error about filename cannot contain x,y,z chars.
The files are stored like this.
What is the name of your weekly file where you are running this from?
Most likely your error is related to the file name having non date parts, which you don’t tell moment to look or for. In other words, when moment is looking for the date and sees “Monday” or similar, it doesn’t know what to do.
Once that is sorted out I would consider making the entire folder path from one call to moment with a more complex date format string…
It do require the tp.file.title to actually be set already, so if you rename it earlier in the template, you need to set the file name into the title variable
The call to tp.file.now() returns an already formatted string, not a date, so if you want to a date to iterate over to get to the rest of the week you either need to repeat code, or change it to actually get a date to manipulate through calls to moment()
Other than that the template should produce two nice links to the Monday of the given week.
And here is a moment() based variant, where it assumes that title holds the week number, like in 2024-W08, and presents the days of the week in a list.
Do note that the .clone() is essential, as if you don’t use it’ll change the date and you could end up with “monday”, “wednesday”, “saturday” since we increment the offset all the time… This could to some extent be circumvented by just adding one to the start, but I think it’s clearer to use the .clone() so that start remains the date for the start of the week all the time.
In my test vault with the file 2024-W08 this resulted in this markdown: