Setting the note creation time and date

What I’m trying to do

Set the note creation date and time to arbitrary values

Things I have tried

I am experimenting with using Drafts on the Mac and iPhone to create notes which I then export into Obsidian. Mostly I’m doing this because I can trigger Drafts actions by tapping a Home Screen icon on my phone, and because it works well with voice dictation. I am a bike commuter, and if I get a good idea while I’m riding, it’s a pain to capture that without using my hands. If I set up a Siri shortcut and a Drafts action, I can do it all with my voice.

When I export a note in Drafts to a file folder, there is an option to set the destination file to have the same creation date and time as the Drafts note. This would be helpful if I created the note on the fly, then ran the Drafts action later.

If I run the action on my phone, I cannot export to the Obsidian vault directly, and I have to use the Obsidian URI interface instead. I can create a note and set the name and YAML ID to the file creation date from Drafts, but the creation date stored in the Obsidian note is the date the note was created in Obsidian, not Drafts. This makes sense to me technically, but it’s not the result I want—I want my note ID and the actual note creation date to agree.

My question is: is there a way via a plugin, Templater command, or javascript that I can set the creation date and time of a note to an arbitrary value? The value would actually come from the creation date of the Drafts note, which I can use to set a YAML value or template field via the Drafts export. I’ve confirmed I can set a folder template in Templater so that it will execute when I create the note via Drafts, and I’m thinking I may be able to set the note’s creation date and time via Templater.

One issue I need to work out is when the Templater template runs. So far when I’ve used Drafts to create a note in a folder with a Templater folder template, the body of the note in the URI from Drafts is ignored. I suspect there is a workaround, but I haven’t yet figured out what that is.

Any ideas? Is my explanation clear? It’s a bit of a niche scenario.

kt

The thread below has macOS–iOS-watchOS shortcuts that can be used with dictation, include a date (or date and time), and work directly with Obsidian. Perhaps some of the ideas could be used for your needs? And be configured to work with Drafts? If not, ignore me. :grimacing:

1 Like

I’ll give that a look. I can easily pull the current date and time and use Templater to pull the file creation date and time. The trick is setting the file date and time to be something else. Or using Obsidian to capture my thoughts in the first place, which appears to be sort of what this shortcut is doing, by way of a quick note.

See my reply to MacOS Shortcut update

I think I’ll be able to implement this either as a Shortcut or a Drafts action.

@anon45210282, that put me on the right track to make Drafts work. I didn’t realize the Obsidian vault was accessible via the On My iPhone folder. I created a bookmark in Drafts to point to my vault, and I can set that on both my MacBook and iPhone to the appropriate folder. Once I did that, it was simply a matter of turning on the Drafts option to make the time and date on the exported file match the time and date of the Draft.

If I use the URI method to create a new note in Obsidian, the creation date and time of the new note will match the URI export time from Drafts, not the time the draft was created. Since the file export method works on both my MacBook and phone, I no longer need to use the URI. Problem solved.

1 Like

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