srg-kostyrko / obsidian-journal

MIT License
70 stars 7 forks source link

Allow date manupulation in template variables #41

Closed arnoesterhuizen closed 3 months ago

arnoesterhuizen commented 3 months ago

In my weekly notes, I would have template variables like

I'd use these variables in dataview queries to find files with text strings for "this week in history" or "this day in history" type features.

Would it be possible to add this, similar to what Periodic Notes has, as I'm keen to replace periodic notes with Journals?

srg-kostyrko commented 3 months ago

this is great idea and I will definitely add it

btw it is hard to say from your description for sure but if you try to find all days in some week won't it be easier to use fields that plugin adds in frontmatter (for week you have first and last day of week in there)?

arnoesterhuizen commented 3 months ago

My primary use for this:

I have notes for people, and in the frontmatter I add a property "dates" which is a list of date strings and notes

dates: 
- "1979-05-20: birthday"
- "2020-08-10: something of note"
- "2021-09-01: something interesting"

In my weekly notes I have a search query that looks for each of the days of the current week:

\```query
[dates:/\d{4}(-04-08|-04-09|-04-10|-04-11|-04-12|-04-13|-04-14): */]
\```

When I open my weekly note I can see a list of any special events I need to remember this week.

I'm still looking for a better way to store a list of dates and special events, but this is what I've come up with for now. :P

arnoesterhuizen commented 3 months ago

Another use-case:

I use quarterly notes, but I also add an alias for the financial year's quarters.

In my quarterly notes template I would add

aliases:
  - FY{{start_date+9M:YYYY-[Q]Q}}

In periodic notes, Liam added {{quarter}} template variables, and at https://github.com/liamcain/obsidian-periodic-notes/blob/f3d7266cdeb59b6f17a18a728c04219e19bac07d/src/utils.ts#L116 you can see the interval changes being applied.