Get Today's Daily Note With Dataview

Hey Everyone!

I searched a bit for a way to pull today’s daily note and the last weekly note with Dataview and got a bunch of conflicting information and ChatGPT was only so helpful (though it did sort of point me in the right direction).

After tinkering with it a bit I figured it out (at least I think).

Get The Daily Note

`="[[" + dateformat(date(today), "cccc-MMM-dd-yy") + "]]"`
  • Have to convert dddd-MMM-DD-YY to cccc-MMM-dd-yy in Luxon.
  • I think this one should work, but we’ll see tomorrow!

Get The Last Weekly Note

`="[[" + dateformat(date(today) - dur(1 day), "yyyy-'W'-WW") + "]]"`
  • Have to convert YYYY-[W]-ww to yyyy-'W'-WW like above.
  • Works as of Tuesday Oct 29 2024 - it correctly pulls week 44s note.

Anyway, I thought I’d post it here in case this helps anyone out.

Cheers!

1 Like

Users can modify the Luxon tokens as needed and also easily add navigation buttons for yesterday, today, and tomorrow.

`="[[" + dateformat(date(yesterday), "yyyy-MM-dd") + "|👈 yesterday]]"` | `="[[" + dateformat(date(today), "yyyy-MM-dd") + "|👇 today]]"` | `="[[" + dateformat(date(tomorrow), "yyyy-MM-dd") + "|👉 tomorrow]]"`
1 Like

Ooooh! That’s awesome @anon45210282!!

I’ve been using Templater to generate my pagination buttons:

⇦ [[<% tp.date.now("dddd-MMM-DD-YY", -1, tp.file.title, "dddd-MMM-DD-YY") %>]] ༺✦༻ [[<% tp.date.now("dddd-MMM-DD-YY", 1, tp.file.title, "dddd-MMM-DD-YY") %>]] ⇨

I love that there are multiple ways to do things in Obsidian.

Thanks for sharing that one!

1 Like