Relative dates in template actions

I have two things I’d like to do when creating a note from a template on an arbitrary date. I suspect they are feature requests:

  1. Set the note title based on the date
  2. Create a reminder using the date

\date seems to always be today, and \event-date doesn’t seem to exist for notes that are not associated with a calendar event.

What I do now is include Title: date(for: DATE, full) and remind( date(for: DAY, short) 6:30am) in the template. After I create the note, I edit the DATE to be whatever it should be, and insert the \ to get Agenda to process the actions. Then I paste the first value into the note title. It works, but of course I’d love to create a note from a template on a certain day and have everything set up and ready to go.

edit: aaaaand as I set up my week template to do the same, I see why it doesn’t do that :slight_smile: I don’t know if \start-date and end-date would be worthwhile or not. FWIW I actually like the behavior of Agenda setting the note title from the selected date. But when using templates on a date range, it sets the title to the template name - so it’s not easy to do that. It ends up being easier to create an undated note from a template, delete the title, and then assign it a date. Which, given that there doesn’t appear to be a way to insert the date to all-day note templates, isn’t much of a deal. It would be nice if we could get \start-date and \end-date in the note body and the default date-based behavior in the title when creating dated notes from templates though.

Both should be possible, as long as days are relative of course (i.e. x days from or before today), absolute dates don’t make sense, then you can just as well hardcode them in the template. So with this in mind it should be possible since we added support already for that:

the same is true for reminders, you should already be able to just type in the remind shortcut in this way:

As long as you keep in mind that dates and reminders are always relative to the day on which you create a note from the template, you can work relative from there.

So for instance, you can if you wanted to create a “Sunday night template” that creates a note with reminders for things on Monday etc. However, if you go this route, I would suggest to invest a bit more time in the shortcuts route, this allows you a lot more flexibility and could literally spit out an entire project for the week independent whether you trigger it on Sunday eve or Monday morning, etc etc. You can even combine the two, have basic templates that you use within an (automated?) shortcut etc.

In my case the dates aren’t absolute or relative, they are arbitrary at the time I create the note. So I have a template that I want to generate a reminder, and I might create the note on today, tomorrow or four days from now. So what I’m asking about is an action that means “the date this note is being created for.” I hope that’s clear.

Sure, but how do you indicate what that date is?

This is when clicking on a date on the sidebar and choosing “New Note from Template…”


1 Like

Ah right, that makes sense, we’ll see if that can be made to work more intelligently indeed.


+1 a note assigned date parameter feature

A possibly related use case: I’d also love the ability to format a group of dates for events that span a range. IE the ability to build a template that generates a list where each item is a (custom formatted, including locale) date for each day spanned by the ‘create note from event’ event instance. Perhaps invoked by a parameter such as \note-date(all)?

I can see the use but not sure whether this makes sense in practice and is too specific. Effectively what you’re asking for is the addition for loops where say for each day in the range of days you want to insert something, correct?