Creating date accurate Yesterday and Tomorrow links for Daily Notes in the future

What I’m trying to do

I am trying to automatically create accurate Yesterday and Tomorrow links (with Templater) when creating Daily Notes in the future using the Calendar plugin.

My current template format works perfectly for creating the links for the current day:

[[<% tp.file.title("dddd, MMMM DD, yyyy", -1) %>|Yesterday]]
[[<% tp.file.title("dddd, MMMM DD, yyyy", +1) %>|Tomorrow]]

But does not work for creating future Daily Notes.

Things I have tried

My Daily Notes are automatically created with the dddd, MMMM DD, yyyy date format as the title, hence the format in the Templater function. For example, my Daily Note today has these links at the top:

[[Wednesday, January 15, 2025|Yesterday]]
[[Friday, January 17, 2025|Tomorrow]]

This is great!

However, when I use the Calendar plugin to create a Daily Note next month, for the 1st of February, this is what comes back:

[[<% tp.file.title("dddd, MMMM DD, yyyy", -1) %>|Yesterday]]
[[<% tp.file.title("dddd, MMMM DD, yyyy", +1) %>|Tomorrow]]

In the console, an error reads: “Templater Error: Template parsing error, aborting.
tp.file.title is not a function”

This is driving me crazy since it works perfectly when a daily note is automatically created, but not when I try to create on for the future.

Here is the daily note Templater code I’ve been using:

← [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[<% tp.date.now("YYYY-MM", 0, tp.file.title, "YYYY-MM-DD") %>]] | [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]] →

You should be able to get your yesterday/tomorrow like:

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

However, when you review that note next week, next month, and so on, the day won’t be yesterday, so I suggest omitting it.

1 Like

Thank you SO much! The line you provided:

[[<% tp.date.now("dddd, MMMM DD, yyyy", -1, tp.file.title, "dddd, MMMM DD, yyyy") %>|Yesterday]]

Works perfectly. Thank you again, that was driving me crazy.

1 Like