Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- ; Set Title
- :title "⌛ On this day..."
- ; Get all blocks
- :query [:find (pull ?b [*])
- ; We want to filter on Today, so we get that variable as input (See input)
- :in $ ?today
- :where
- ; Now to filter, first, we only want journal pages
- [?b :block/page ?p]
- [?p :page/journal? true]
- ; Then we fetch the Day of the Journal page, store it in ?jd
- [?p :page/journal-day ?jd]
- ; Tricky part, but what happens it turns date into string
- ; Not sure, but I assume unix timeformat so YYYYMMDD
- ; Then use subs to cutoff the YYYY
- [(str ?jd) ?jds]
- [(subs ?jds 4 8) ?md1]
- ; Then we do the same trick for today
- [(str ?today) ?td]
- [(subs ?td 4 8) ?md2]
- ; What we are left with is a compare of Today without year, matches pages
- ; without year
- [(= ?md1 ?md2)]
- ; Finally filter out today, as that's not history....yet
- [(< ?jd ?today)]
- ]
- ; Make Logseq provide todays date
- :inputs [:today]
- ; Why yes we want to see the year
- :breadcrumb-show? true
- ; And show me everything unfolded
- :collapsed? False
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement