Correct dates in daily notes

hello everybody. I’m having a problem with creating future notes. Let me explain:

I’m using the “periodic notes” plugin to create my daily/weekly/monthly notes.
The plugin creates the daily notes with the following filename syntax:
YYYY-MM-DD

In my daily notes template, I have the following templater syntax:

# <% tp.date.now("ddd, DD-MM-YYYY") %>
<< [[<% tp.date.now("YYYY-MM-DD", -1) %>]] | [[<% tp.date.now("YYYY-MM-DD", 1) %>]] >>

so that I have an H1 heading with the day and date, then links to the previous and following days.

This works well and fine if I create the daily note in the relevant day. However, if I create a daily note in advance, it messes up the dates. It will have the H1 and links relevant to the creation date, not the actual date of that note.

This is a problem especially if I’m using the “Review” plugin to put notes for review in a future note.

Is there a way to re-format my template to have the dates according to the real date for that daily note? thanks :slight_smile:

Can the date be based on the file’s title?

File's title date + 1 day (tomorrow): <% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>
File's title date - 1 day (yesterday): <% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>

Taken from Examples on this page:

https://silentvoid13.github.io/Templater/internal-functions/internal-modules/date-module.html

Angel

The Periodic Notes plugin enables template stuff (including date math) that handles this correctly. I don’t know how I learned this because it’s not mentioned in the plugin’s README. (Maybe I learned from ryanjamurphy’s post? Daily notes (next-previous - #10 by ryanjamurphy)

Examples:

  • Link to day before daily note: [[{{date-1d: YYYY-MM-DD}}]]
  • Link to day after daily note: [[{{date+1d: YYYY-MM-DD}}]]
1 Like

great! that works, thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.