Automatically update last modified date in note

Is there any trick that could put this in the frontmatter?



How can I use it inside markdown?

alias: "paper note"
last-reviewed: `$= dv.current().file.mtime`

Doesn’t work for me :confused:


Trying to figure this one our as well - Did you manage to figure it out?

I am trying to put it in the frontmatter of my Templater template

1 Like

This is really easy to do with a plugin. I just made a quick one to do it, which is now in the plugin store.

Super simple, it will automatically update a YAML/frontmatter property every time a file is modified.


What or how anything is different in yours from Update time on edit plugin?

1 Like

This part:

This plugin will read the ctime and mtime from the file system. If file change from an external source, the header keys will be updated.

The one I made only updates the time when you edit the note inside Obsidian, rather than if the file modified time changes for whatever reason (example copying files to a new computer).

Different approach depending what you want.


I actually disabled that plugin (which had been updated twice in succession and I found something detrimental) a few days ago when I batch-changed my YAML and was looking for an alternative solution. I’ll try yours.


1 Like

Sure, give it a go. It’s very simple, this is the whole code:

this.registerEvent('modify', (file) => {
  if (file instanceof TFile) {, (frontmatter) => {
      frontmatter[property] = moment().format(format)

I only wrote it as an example for this thread, but it does what it needs to.


“yyyy-MM-dd” format is not honoured. Day is exchanged for Tue (it’s Tuesday where I’m at).

Also, same as the other plugin (now I remember why I disabled it), double-quotes my frontmatter keys (tags field). How come?

Yes it is, you just didn’t use MomentJS format like it mentions.

Nothing is double quoted at my end. If you’re using 1.4.x just remember that it’s not ready yet and they’re still fixing bugs.

1 Like

YYYY-MM-DD indeed works.
It’s only one tag actually. I’ll figure it out.


Hi, I’ve tried implementing this but I am getting the following error message. Anybody know how to solve this?

I have opened a new fault in Obsidian and now the times do work. Anybody knows what the issue might be?

Excellent, this is what I was looking for. System mtime is changed each time my Dropbox synchronizes files between different machines, so it’s frequently not reflecting actual time, while your plugin will update the modification time only when I actually edit the file.

1 Like

Glad to help :+1: I have no idea why the other two plugins which update a modified field use the file system time.


Truth be told, when running normal or regex replacements from other programs (Notepadqq, for instance), I see the field updated – but Obsidian was left open.

Slightly more concerning is this. Disabling these plugins seems to make this confounding issue stop.

  • Wonder what is causing the interference here.

Now I use the manual way of Save [Contrl+S] with Linter (Lint current file with ‘lint on save’), which updates date modified.

That makes perfect sense, because Obsidian is executing a “note modified” event each time the note is modified.

Regarding the linked issue, if iCloud is constantly modifying notes in the background … that seems a little concerning :grimacing: I don’t have a Mac so can’t comment on that, but it doesn’t sound good.

In terms of updating frontmatter on modified, perhaps there is another event to hook into rather than the “note modified” event. I’ll have a look.


@gino_m I have updated the plugin to v1.1.0 with a new experimental update mode.

Instead of using Obsidian’s built-in “file has been modified” event, the new mode will watch for typing events in the editor view, and only update the frontmatter when actually typing occurs.

Can you please test this and see if it solves your use-case?

edit: I think you will need to restart Obsidian after changing that setting for it to work. I forgot to watch for the setting change and then re-register the plugin events.

I am curious about your opinion on what triggers the automatic merging issues (nothing to do with iCloud or sync) and how these changes effected by you will be an improvement?