Correct format for Date & Time template variables in properties?

I’m using the “Templates” core plugin.
I’m trying to use template variables such as {{date}} and {{time}} as property values in a template file.

Is this standard practice?

If so, what is the correct way to format a template variable for a Date & time property value?

I’ve seen many people suggest, {{date}} {{time}}, but the Properties panel reports “Invalid properties.”

My best guess is {{date:YYYY-MM-DDTHH:mm}} based on the end result and what the Properties panel seems to accept.

Thanks for your help.

4 Likes

I have the same exact question. I used to have a “date” line in the header info. After updating to the new version of Obsidian with properties, all my old files turned that into a “date type” property. But now I’m not sure how to include the {{date}} {{time}} variable in my template so that the date filed is automatically set when I insert the template into new notes

1 Like

I was also wondering this, it was nice having the date inserted from my templates and now that’s broken.

Actually apologies it just appears to work now?

I just have {{date}} in my template file

1 Like

Is there already a solution or open issue for this bug?

In my templates I use this line:

created: {{date}}

Switching to the preview mode I see this:

image

After editing another property in this mode I will find this:

created:
“{ date }”:

And after applying the template the creation date will not be set:

image

I would vote for a bug → I opened a bug report.

Workaround

  1. Open note in default app.
  2. Write again {{date}}
  3. Save

It should be good for this template and don’t change again.

More stable solution is community plugin Templater (not Templates).

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