I’ve been using Templater for several months with no issues at all, but I’ve recently run into a weird problem. My use of Templater is probably about as basic as you can get, (I use it for Date Created and Date Modified) but…
Templater is not updating the “Modified Date” on notes any more. It remains static even after editing the note, moving to a new one and then back to the one I edited.
If I try running the template (ALT-R) while in the note, the Date Created and Date Modified Templater code both get replaced with the text: “NaN”
creation date: NaN
modification date: NaN
Oddly, I’ve never run into that issue before, but I also only discovered the Templater ALT-R feature while trying to do troubleshooting and re-reading the docs.
Looking back at some of my backups, a backslash has appeared on every note and the every template. I don’t remember if this was some older Templater syntax or if something odd has happened to add it. As I mentioned, Templater stamping of Date Created and Date Modified has been working perfectly for probably close to a year, if not longer.
Here’s an example of what I see in pretty much every note and template file now with that backslash added:
**Created:** <%+ tp.file.creation\_date() %> **Modified:** <%+ tp.file.last\_modified\_date() %>
I’ve replaced my Date Created and Date Modified code with a copy/paste directly from the Templater documentation, so they are now currently:
creation date: <% tp.file.creation_date() %> modification date: <% tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %>
That stamps the note correctly, but doesn’t update it after an edit.
If I add a + after the opening <% so I have <%+ (which is what I’ve been using for several months with no issues) it seems to work, but only sometimes… Sometimes it works, and sometimes it just displays the Templater code as text when you switch the view on the note from Edit to Read.
creation date: <%+ tp.file.creation_date() %> modification date: <%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %>
Oddly, if I add the backslash back in, it seems to have no impact either way…
- I’ve uninstalled and re-installed Templater. (I also confirmed the folder for the plugin was deleted after I uninstalled Templater.)
- I confirmed the core Templates plugin was still disabled.
- I confirmed the core Daily Note plugin was still disabled.
What I’m trying to do is have Templater do what it’s being doing beautifully for a loooong time.
- Show the date the Note was created.
- Show the date the Note was modified.