Skip to content

Instantly share code, notes, and snippets.

@jdheyburn
Last active January 5, 2024 09:35
Show Gist options
  • Save jdheyburn/f0e21fa2671625a21941074f1c94ada1 to your computer and use it in GitHub Desktop.
Save jdheyburn/f0e21fa2671625a21941074f1c94ada1 to your computer and use it in GitHub Desktop.
Obsidian journalling templates
<%*
moment.locale("gb")
const thisDay = window.moment(new Date(tp.file.title));
const previousDay = thisDay.clone().subtract(1, 'days');
const previousDayFmt = previousDay.format("YYYY-MM-DD")
const lastYearDay = thisDay.clone().subtract(1, 'years');
const nextDay = thisDay.clone().add(1, 'days');
const nextDayFmt = nextDay.format("YYYY-MM-DD")
const thisWeek = thisDay.format("YYYY-[W]ww")
const thisMonth = thisDay.format("YYYY-MM-[M]")
const thisDayLong = thisDay.format("dddd Do MMMM YYYY")
const thisYear = thisDay.format("YYYY-[Y]")
-%>
---
date: <% tp.date.now("YYYY-MM-DD") %>
createdAt: <% tp.file.creation_date() %>
weekly: <% thisWeek %>
monthly:
- <% thisMonth %>
yearly: <% thisYear %>
dateShort: <% thisDay.format("dddd Do MMMM") %>
aliases:
- <% thisDayLong %>
---
# <% thisDayLong %>
<< [[planner/daily/<% previousDayFmt %>|<% previousDayFmt %>]] || [[planner/daily/<% nextDayFmt %>|<% nextDayFmt %>]] >>
[[<% thisWeek %>]] || [[<% thisMonth %>]]
---
## Summary 🏁
```dataview
TABLE WITHOUT ID DailySummary as "This time last year: <% lastYearDay.format("dddd Do MMMM YYYY") %>"
FROM "planner/daily"
WHERE file.name = "<% lastYearDay.format("YYYY-MM-DD") %>"
```
DailySummary::
<%*
moment.locale("gb")
const thisMonth = window.moment(tp.file.title, "YYYY-MM-&M ");
const thisQuarter = thisMonth.format("YYYY-[Q]Q")
const previousMonth = thisMonth.clone().subtract(1, 'months')
const nextMonth = thisMonth.clone().add(1, 'months')
const thisYear = thisMonth.format("YYYY-[Y]")
-%>
---
date: <% tp.date.now("YYYY-MM-DD") %>
createdAt: <% tp.file.creation_date() %>
quarterly: <% thisQuarter %>
yearly: <% thisYear %>
---
<< [[<% previousMonth.format("YYYY-MM-[M]") %>]] || [[<% nextMonth.format("YYYY-MM-[M]") %>]] >>
[[<% thisQuarter %>]]
[[<% thisYear %>]]
## Summaries
```dataview
Table without id ("[["+file.name+"]]") as "Weekly summaries", WeeklySummary as " "
FROM "planner/weekly"
WHERE contains(monthly, this.file.name)
SORT file.name ASC
```
> [!hint]
> Anything written under the **Month summary** section is added to the quarterly review.
### Monthly summary
<%*
moment.locale("gb")
const thisQuarter = window.moment(tp.file.title, "YYYY-&Q Q");
const theseMonths = [...new Set([0,1,2].map(m=>thisQuarter.startOf("quarter").clone().add(m, "months")))]
const thisYear = thisQuarter.format("YYYY-[Y]")
-%>
---
date: <% tp.date.now("YYYY-MM-DD") %>
createdAt: <% tp.file.creation_date() %>
yearly: <% thisYear %>
---
## Summary
> Insert quarterly summary here
## Months
<%* theseMonths.forEach(month => { %>### <% month.format("MMMM") %>
![[<% month.format("YYYY-MM-[M]") %>#Monthly summary]]
<%* }); %>
<%*
moment.locale("gb")
const thisWeek = window.moment(tp.file.title, "YYYY-&W WW");
const previousWeek = thisWeek.clone().subtract(1, 'weeks')
const nextWeek = thisWeek.clone().add(1, 'weeks')
const theseMonths = [...new Set([1,2,3,4,5,6,7].map(d=>moment(`${tp.file.title}-${d}`, "YYYY-W-E").format("YYYY-MM-[M]")))]
const thisYear = thisWeek.format("YYYY-[Y]")
-%>
---
date: <% tp.date.now("YYYY-MM-DD") %>
createdAt: <% tp.file.creation_date() %>
monthly: <%* theseMonths.forEach(month => tR += `\n - ${month}`) %>
yearly: <% thisYear %>
---
<< [[<% previousWeek.format("YYYY-[W]ww") %>]] || [[<% nextWeek.format("YYYY-[W]ww") %>]] >><%* theseMonths.forEach(month => tR += `\n[[${month}]]`) %>
```dataview
Table without id ("[["+file.name+"|"+dateShort+"]]") as "Daily Summaries", DailySummary as " "
FROM "planner/daily"
WHERE weekly = this.file.name
SORT file.name ASC
```
## Summary
WeeklySummary::
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment