-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Patch date created: handle both Local and UTC dates #43
Conversation
both date functions work to successfully patch a Note's date or utc-date attribute. however it's incomplete because we should force them to match each other so the db is not inconsistent. That's a remaining TODO.
…ocal date patch works but utc fails.
My test script: patch-date-test.py.txt |
Thanks for the big PR! 😊 I have some feedback regarding your changes:
|
Thanks for the feedback! I was so deep in my local problem I overlooked that date changing is only sometimes the goal. Hah. I'll get on both of these suggestions. |
|
It works great. I've just made a new release. |
oh! I expected some more changes needed. Wonderful that wasn't needed =) |
I don't mind commented code; I have a lot of commented code in my own work. I can merge the clean-up PR if you'd like. |
it can wait until my next contribution (I know what that is yet. I just know that tri-py is useful enough to me that I'm building workflows around it, and will want something else changed too) |
This patch is a bigger touch than the last one and I don't expect it to pass review without changes.
Patch_notes will now take the provided date, convert it to whichever of local or utc is missing, and set both properties on the target note. To use, call
ea.patch_notes()
using either ofdateCreated
orutcDateCreated
optional parameters but not both. If timezone info is missing from the datetime object Patch_notes will use the tz of the local machine.Example output for
res = ea.patch_note(noteId, utcDateCreated=mydate)
follows. Lines prefixed with---
are from my test script (so not emitted from trilium-py):The new functions are:
They could be collapsed into one function. I went back and forth a lot on that.
The pyproject.toml changes can be ignored/discarded. (After review I'll create a new branch with just the clean changes and a fresh PR.)
Known deficits:
I started this almost a full month ago and busted my brain several times sorting out a path that worked, and didn't reverse local/utc or some other logic error. I'm out of my comfort zone and will not be surprised at any mistakes pointed out!