I went looking for this in the forum and elsewhere and couldn’t find a definite answer:
How can I be sure to track when a note was created, and when it was last edited?
I think this is available in the filesystem metadata of the file (I’m not to sure how that works), but when syncing between devices, is it still going to work? If I create a file in device A, and tomorrow I open obsidian in device B, it will sync and create that file, so will the original metadata be preserved? Can I trust that no matter the OS?
Or is there some way to have those things be tracked in the note body itself?
To start you need to understand what’s the yaml frontmatter: YAML front matter - Obsidian Help
Is a place where you can add some metadata to your notes.
Then you can add some data manually or use some plugins to auto-write some data: for example, Template or Templater plugins.
Be careful with creation date. Many cloud storage providers have different ideas of what acreation date is, and I have finally given up (I use Dropbox which thinks syncing of a new file, the creation date is the sync, not the actual creation on the client) and I use creation date in the YAML, which is effectively hardcoded at the time the Note is created. Then I use Templater to give me dynamic modified date like this:
<%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %>
For Dataview lists and tables, I just use Modified date. Here is an example from my Daily Note that shows all files modified in the last 7 days (which implies also created).
TABLE file.frontmatter.topic as "Topic", file.mtime as "Modified", file.folder as "Path"
WHERE file.mday != this.file.mday AND file.mtime >= (this.file.mtime - dur(7 d))
SORT file.mtime DESC
The Linter plugin is also capable of modifying YAML timestamp values. You can enable “Lint on save” and also enable “Keep track of the date the file was last edited in the YAML front matter. Gets dates from file metadata.”. You can also adjust the key name. By default they are date created and date modified.
I am definitely not a longtime user of this plugin , but I just installed and tested it, and it works. It was simple enough to adjust the default date/time format in the settings, such as YYYY-MM-DD HH:mm:ss. The only hard part is remembering to press ctrl s.
I tried the Liner plugin here. It’s really convenient
Hmm but that means if I created a file in my PC for example, then I go to my phone, it syncs and messes up the created/updated file metadata, when I save the note, the plugin will update the YAML with the messed up values right? (assuming plugins work on a phone (?))
I have found, and purely anecdotal, with no science involved, that the modified date seems to be preserved across file systems, and cloud syncs.
Disclaimer: I don’t use windows, so not sure about that, but across ext4 on linux, APFS, Dropbox and ios, the modified time seems to be preserved well.
Sorry, a lot of variables here, but one for sure is Dropbox’s idea that a creation time is when the file is originally sync’ed, not created on the client is (IMHO) not right. I can’t speak for Google Drive or OneDrive, perhaps they handle it differently.
I’m testing that Plugin. It looks like it does exactly what I was looking for. It’s just weird that it doesn’t update immediately, it takes some time to update the info. It’s a bit finicky how it updates, I haven’t figured out fully how it behaves yet, but seems promising. I’ve confirmed it doesn’t use the file system metadata so no issues there
Yeah the “Update time on edit” is not working for me. It has some bug and weirdness in it. It has added timestamps, most of the time. But there is a note that I have had sitting there for a long time, well over the 1 minute configured in the plugin, and no timestamps to be found
I’m starting to play with syncing files with Google Drive as well. When the the Google drive syncing is activated (just the native Google Drive sync, no external tools), it will keep updating the updated_at date all the time, even if the file contents are not edited
I don’t have obsidian sync yet. I was considering buying it. But I can’t know if I’m gonna have the same issue with obsidian sync, so I don’t know what to do
I’m thinking either I give up using Obsidian, or I give up being able to keep track of recent files, or I try to write a plugin myself