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

Notion 'YYYY-MM-DD' Dates are saved as 'YYYY-MM-DDTHH:MM:SSZ' DateTimes #26

Open
gigena-git opened this issue Dec 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@gigena-git
Copy link

Hello again! These two bugs are related and I saw them after this issue was solved:

Bug 1

When I try to update a date with:

anyquery -q "UPDATE notion_database SET \`Review Date\` = '2024-12-17' WHERE _page_id = '15776305-7c51-80db-ada0-f8cb0daa92cb';"

or with:

anyquery -q "UPDATE notion_database SET \`Review Date\` = '17/12/2024' WHERE _page_id = '15776305-7c51-80db-ada0-f8cb0daa92cb';"

Then, on the Notion UI I see that the "Include Time" flag set to true, and the time is 00:00:00 in the UTC timezone.

The expected result is that the new value for Review Date should be just a date with no time specified ("Include Time" set to false).
(PS: When I update a date with either YYY-MM-DDTHH:MM:SSZ or with YYYY-MM-DDTHH:MM:SSZ/YYYY-MM-DDTHH:MM:SSZ (with Z being any offset) the date time is saved correctly).

Bug 2

Moreover, let's say that in my table I have more fields that are also date fields, and each of these fields contain a date (or two dates with or without time) So, if I want to modify the Title field of the row, and I run this:

anyquery -q "UPDATE notion_database SET \`Title\` = 'New Name' WHERE \`_page_id\` = '15776305-7c51-80db-ada0-f8cb0daa92cb';"

Then, all date fields are ALSO modified like this:

  • If the field had the "Include Time" flag set to false, it is now set to true and, the time is 00:00:00 in the UTC timezone.
  • If the field had the "Include Time" flag set to true and the time zone was Z, then the field stays as is.
  • If the field had the "Include Time" flag set to true and the time zone was not Z, then the field is still shown with the correct offset, but the time zone id is gone (from the UI).

The expected result is that any field that I'm not explicitly modifying in the UPDATE command should stay as it is.

@julien040
Copy link
Owner

Hello @gigena-git,
Thank you for opening an issue.

About the first bug, it's a known issue with the third-party library I'm using to connect to the Notion API jomei/notionapi#177. I can try to push for a pull request, but I can't guarantee anything.

About the second bug, I've fixed it in abbb833 and 527d410. It'll be available in the next anyquery version. I'll ping you when the version is released.

@julien040 julien040 self-assigned this Dec 21, 2024
@julien040 julien040 added the bug Something isn't working label Dec 21, 2024
@julien040
Copy link
Owner

Hello @gigena-git,
Now, non-updated date fields should stay as they are. To get the fix, update Anyquery to 0.3.1 and update the Notion plugin with

anyquery registry refresh
anyquery plugin update notion

I'm still looking into fixing time zones and date-only fields. I can't give you an ETA, though, because it depends on the library maintainer.

@gigena-git
Copy link
Author

Hello! Sorry for the delay.
I just tested the partial update and works fine! I'll let you know if I find anything else.
Happy holidays!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants