Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
justyns opened this issue Aug 26, 2023 · 5 comments
Open

Comments

@justyns
Copy link

justyns commented Aug 26, 2023

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, Nriver/trilium-py#24

@zadam
Copy link
Owner

zadam commented Aug 29, 2023

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

@justyns
Copy link
Author

justyns commented Sep 2, 2023

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
Copy link
Owner

zadam commented Sep 5, 2023

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
Copy link
Author

justyns commented Sep 9, 2023

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants