Unable to use <%%> inside of [[]]

What I’m trying to do

I’m trying to create a simple template, with the following line:
[[ <% tp.date.now(“YYYY-MM-DD”) %> ]]

But receive the following error:
file cannot contain the following characters: * / < > " : ? \

Now I assume that it is probably a setting that I misconfigured or missed.
But I’m unable to find which setting it is.

Things I have tried

I disabled the core plugin of templates and daily notes
I installed dataview and periodic notes
I tried playing with the code but nothing helped.

Sorry if it is a duplicate I was unable to find a similar post

How do you apply the Templater’s template ? :blush:

Because what you wrote first need to be read and parse by Templater (so it can replace the tp.date.now() by a date) before clicking on the “link”…

1 Like

Here, I am running this command:


Note top, template bottom.

CleanShot 2025-07-14 at 18.55.58

1 Like

This worked!
But now I have a different line failing when doing this hotkey.

[[<% tp.date.now("DD-MMMM-YYYY", "-1d", tp.file.title, "DD-MMMM-YYYY") %>]]

it prompts :
Templater Error: Invalid reference date format, try specifying one with the argument ‘reference_format’

This is probably because the note’s title in which you apply/run the template doesn’t follow the format ("DD-MMMM-YYYY") you’ve “said” tp.file.title follows ? :woman_shrugging:

Although, I think the "-1d" could, potentially, also play a role :thinking:

I think, the offset argument in tp.date.now() can only take a number (representing a number of days to add or subtract) or an ISO8601 duration string (iirc :sweat_smile: )
So, you might want to try this (to get “yesterday” based on the note’s title):

[[<% tp.date.now("DD-MMMM-YYYY", -1, tp.file.title, "DD-MMMM-YYYY") %>]]

… after making sure the template is applied on a note titled following the DD-MMMM-YYYY format :blush:.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.