Most of the whole snippet you shared is actually commented out (99% of the lines start with //
… which is how you add line comment in JS) …
So, unless something happened when you copied/pasted it here, it could explain why it doesn’t work …
This seems to work though :
<%*
// Get today's date from the daily note's title
// Daily note title format is "dddd-MMM-DD-YY"
const today = moment(tp.file.title, "dddd-MMM-DD-YY");
// Format today as "YYYY/MM/DD - dddd"
const heading = moment(today).format("YYYY/MM/DD - dddd");
// Format today as "YYYY" (for the link to the year)
const yearLink = moment(today).format("YYYY");
// Format today as "YYYY[-Q]Q[|Q]Q" (for the link to the quarter)
const quarterLink = moment(today).format("YYYY[-Q]Q[|Q]Q");
// Format today as "YYYY-MM[|]MMMM" (for the link to the month)
const monthLink = moment(today).format("YYYY-MM[|]MMMM");
// Format today as "gggg[-W-]ww[|Week ]w" (for the link to the week)
const weekLink = moment(today).format("gggg[-W-]ww[|Week ]w");
// Get "yesterday" and format it as "dddd-MMM-DD-YY[|]YYYY-MM-DD"
const yesterdayLink = moment(today).subtract(1, 'd').format("dddd-MMM-DD-YY[|]YYYY-MM-DD");
// Format today as "YYYY-MM-DD"
const todayNav = moment(today).format("YYYY-MM-DD");
// Get "tomorrow" and format it as "dddd-MMM-DD-YY[|]YYYY-MM-DD"
const tomorrowLink = moment(today).add(1, 'd').format("dddd-MMM-DD-YY[|]YYYY-MM-DD");
-%>
# <% heading %>
[[<% yearLink %>]] / [[<% quarterLink %>]] / [[<% monthLink %>]] / [[<% weekLink %>]]
❮ [[<% yesterdayLink %>]] | <% todayNav %> | [[<% tomorrowLink %>]] ❯
Note: the snippet, to work properly, needs to be applied to note titled following the format you chose for your daily note’s title … as the title is used in the snippet to determine when “today” is and format its date in various ways
So, the snippet applied to a note titled Saturday-October-26-24
output:
# 2024/10/26 - Saturday
[[2024]] / [[2024-Q4|Q4]] / [[2024-10|October]] / [[2024-W-43|Week 43]]
❮ [[Friday-Oct-25-24|2024-10-25]] | 2024-10-26 | [[Sunday-Oct-27-24|2024-10-27]] ❯
This can be adapted to your wishes/needs
I’m sadly a bit too short on time to give more explanations/informations … but I hope it will still help a little
…