obsidian_bear icon indicating copy to clipboard operation
obsidian_bear copied to clipboard

Attempt to keep timestamps of the original Bear notes

Open bernardoamc opened this issue 1 year ago • 6 comments

This will allow users to still see the expected order of their files based on the modified date when migrating to Obsidian.

See #9

bernardoamc avatar Mar 05 '23 21:03 bernardoamc

@coding-camel Do you have time to see if this fully (or partially) solves the timestamp issues? If so, I will adjust tests and merge the PR so everyone can enjoy a better migration process. :)

bernardoamc avatar Mar 05 '23 21:03 bernardoamc

@bernardoamc

I tested this pr today, If a note was created at 12:40 and modified at 12:41.

Running the script at 12:43 makes it created at 12:41 and modified time of 12:41

So keeps the modified date. But loses the created date, which is the most important in my opinion.

rookbreezy avatar Mar 06 '23 11:03 rookbreezy

@coding-camel Thanks for taking a look! I will spend some time playing with it to see what can be done, we are moving in the right direction. 😄

bernardoamc avatar Mar 06 '23 14:03 bernardoamc

Hey there, hope no one minds me jumping in!

I ran into the same problem with the created timestamp when I tried to build a similar script in node.js. From my research it seems like you can't preserve or overwrite created value if we are copying the file over.

I sorta worked around it, but with a caveat:

To keep all of the original timestamps, I ended up storing the edited time first, then make all of the formatting changes directly to the original file in the Bear folder and move it over to preserve the files's created time. Lastly we write the original edited value back b/c we made those formatting changes directly to the original files.

The catch is that my solution requires the file itself to move. It only really worked because I only wanted the first tag to create the folder structure, instead of duplicating notes for each tag in a note. I'm not 100% sure how to implement that if we need to duplicate the notes for all of the tags within but hope it helps!

DraconMarius avatar Apr 15 '23 01:04 DraconMarius

@DraconMarius Thank you for the insights, I really appreciate it! This is a fun problem to tackle.

I've been struggling to find time to make the necessary changes, but I'm totally open to incorporate those changes if anyone would like to take a stab at it. I also hope I can find more time soon to improve a few things in the code. 😄

bernardoamc avatar Apr 16 '23 03:04 bernardoamc

@bernardoamc Of course no problem at all! I was tunnel visioned on that problem for far too long haha.

I don't know anything about ruby but will definitely take a stab at it one of these days too :)

DraconMarius avatar Apr 18 '23 21:04 DraconMarius