Skip to content

Instantly share code, notes, and snippets.

@dannberg
Last active May 5, 2026 09:58
Show Gist options
  • Select an option

  • Save dannberg/48ea2ba3fc0abdf3f219c6ad8bc78eb6 to your computer and use it in GitHub Desktop.

Select an option

Save dannberg/48ea2ba3fc0abdf3f219c6ad8bc78eb6 to your computer and use it in GitHub Desktop.
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[Timestamps/<% tp.date.now("YYYY", -1) %>/<% tp.date.now("MM-MMMM", -1) %>/<% tp.date.now("YYYY-MM-DD-dddd", -1) %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1) %>/<% tp.date.now("MM-MMMM", 1) %>/<% tp.date.now("YYYY-MM-DD-dddd", 1) %>|Tomorrow]] >>
---
### πŸ“… Daily Questions
##### 🌜 Last night, after work, I...
-
##### πŸ™Œ One thing I'm excited about right now is...
-
##### πŸš€ One+ thing I plan to accomplish today is...
- [ ]
##### πŸ‘Ž One thing I'm struggling with today is...
-
---
# πŸ“ Notes
- <% tp.file.cursor() %>
---
### Notes created today
```dataview
List FROM "" WHERE file.cday = date("<%tp.date.now("YYYY-MM-DD")%>") SORT file.ctime asc
```
### Notes last touched today
```dataview
List FROM "" WHERE file.mday = date("<%tp.date.now("YYYY-MM-DD")%>") SORT file.mtime asc
```
@rahulcsaluja

Copy link
Copy Markdown

@dannberg : Thank you very much for the efforts you have put in to create these documents. Much appreciated.

I was facing the parsing error while using the code you provided. Even after replacing the " with ' in the code, it didn't work (Screenshot attached). I threw it into ChatGPT and it gave me the following code which worked for me.

Solution that worked for me

Notes created today

LIST WHERE file.cday = date(today) SORT file.ctime ASC

Notes last touched today

LIST WHERE file.cday >= date(today) AND file.cday < date(today) + dur(1 day) SORT file.ctime ASC

image image

@loeffelandi

loeffelandi commented Mar 17, 2026

Copy link
Copy Markdown
<%*
const d = moment(tp.file.title, 'YYYY-MM-DD');
const prev = d.clone().subtract(1, 'days');
const next = d.clone().add(1, 'days');
tR += `# ${d.format("dddd, MMMM DD, YYYY")}

<< [[Timestamps/${prev.format("YYYY")}/${prev.format("MM-MMMM")}/${prev.format("YYYY-MM-DD-dddd")}|[previous day](https://gist.github.com/dannberg/Timestamps/$%7Bprev.format(%22YYYY%22)%7D/$%7Bprev.format(%22MM-MMMM%22)%7D/$%7Bprev.format(%22YYYY-MM-DD-dddd%22)%7D)]] | [[Timestamps/${next.format("YYYY")}/${next.format("MM-MMMM")}/${next.format("YYYY-MM-DD-dddd")}|[next day](https://gist.github.com/dannberg/Timestamps/$%7Bnext.format(%22YYYY%22)%7D/$%7Bnext.format(%22MM-MMMM%22)%7D/$%7Bnext.format(%22YYYY-MM-DD-dddd%22)%7D)]] >>`;
-%>

I changed the navigation links to actually work for advancing through the daily notes. it gets the date from the file title (parsed via moment(tp.file.title, 'YYYY-MM-DD')), then computes yesterday and tomorrow by cloning that moment and subtracting/adding one day.

Date parsing

tp.file.title gives Templater the current note's filename (e.g. 2026-03-18). moment() parses that string into a moment object using the YYYY-MM-DD format, so all subsequent date math is based on the actual note you're in β€” not "today."

Navigation link construction

For each neighbor (prev/next), it builds an Obsidian wikilink in the format:
[[Timestamps/YYYY/MM-MMMM/YYYY-MM-DD-dddd|display text]]
This mirrors your folder structure exactly β€” year at the top level, then a MM-MMMM subfolder (e.g. 03-March), then the full dated filename with weekday appended.

@KevinMeinon

Copy link
Copy Markdown

How to fix incorrect "Tomorrow" and "Yesterday" links:

<< [[Timestamps/<% tp.date.now("YYYY", -1, tp.file.title, "YYYY-MM-DD") %>/<% tp.date.now("MM-MMMM", -1, tp.file.title, "YYYY-MM-DD") %>/<% tp.date.now("YYYY-MM-DD-dddd", -1, tp.file.title, "YYYY-MM-DD") %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1, tp.file.title, "YYYY-MM-DD") %>/<% tp.date.now("MM-MMMM", 1, tp.file.title, "YYYY-MM-DD") %>/<% tp.date.now("YYYY-MM-DD-dddd", 1, tp.file.title, "YYYY-MM-DD") %>|Tomorrow]] >>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment