zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.2k stars 1.9k forks source link

(Feature request) Modify note creation and modification time through api? #4199

Open justyns opened 1 year ago

justyns commented 1 year ago

Describe feature

I'm currently testing out Trilium (thanks so much for making it!), and one of the things I want to do is import all of my old notes from Joplin and Obsidian.

I have this mostly working thanks to trilium-py, but one thing I haven't been able to figure out yet is how to set the note's creation and lastupdated timestamps. Is this currently possible using the ETAPI somehow?

If not, would you consider this as a feature request?

Thanks!

Additional Information

For reference, https://github.com/Nriver/trilium-py/issues/24

zadam commented 1 year ago

I've added the possibility to specify dateCreated and utcDateCreated to the ETAPI. The modification date is still generated automatically.

justyns commented 1 year ago

Awesome, thank you @zadam . Are you not wanting to allow updating the modification date at all? I think it'd be useful when importing notes, but I don't know if there's a use-case outside of that to be able to change it later.

zadam commented 1 year ago

It's kinda difficult/fragile because modification time is just set with each insert/update. I also assume it's generally less valuable than the creation date since it's bound to be changed by mistake or otherwise ...

justyns commented 1 year ago

Got it, thanks! I also noticed the modified time is based on the different revisions instead of just the note itself, so I could see it being finicky.

I ended up writing a backend script to convert label attributes to created/updated timestamps after the notes are created: https://github.com/justyns/trilium-scripts/blob/master/joplin-import-helpers/joplin-convert-attribute-to-ctime.js

It was just a one-time thing for me so not super worried about it breaking anything, but it does use sql directly

meredithmp commented 8 months ago

Is there a way to change creation dates from the front-end, or is this the only method? Thanks in advance.