Hey! I’m close to ultimate Notion ↔ Google Calendar sync. But when I need to update GCal time, I have a problem.
Describe the problem
On update, GCal adds N hours to start/end, where N is Timezone. And there’s no option to disable this, like in “Get many events” operation.
I have +6 hours Timezone. So instead of 15:00-16:00 it’s updated to 21:00-22:00.
There is no such a problem on create an event. , So my workaround is very straight and stupid. Delete the event, create a new one, update the backward id in Notion.
Information on your n8n setup
n8n version: 0.236.3
Database (default: SQLite): dedaut
n8n EXECUTIONS_PROCESS setting (default: own, main): main
Running n8n via (Docker, npm, n8n cloud, desktop app): Docker compose
Operating system: Ubuntu
could you share that part of your workflow, so it’s easier to understand how to fix the problem.
A couple of possible solutions to look at:
- In your workflow settings you can change the timezone.
- You could use some of the Luxon timezone features (some info here)
Let me know
All the best
I think, the Update Gcal needs some rework to add Timezone accounting. “Create new” is ok, and “Update” just messes time up. I can’t fix that changing timezones, it will break other processes. The only thing I see is offsetting time in the expression by the Timezone amount. I have no clue how to do that
Here is this part of the workflow.
is you want to remove 6 hours from a given time you can use the Luxon library like this:
(more info about Luxon here and here.
Please find a full example here:
Let me know if that helps
Hey @giulioandreini Unfortunately, this hardcoding doesn’t help at all. I need a solution that counts for any the Timezone settings, not just hardcoded 6 hours.
This is why I ask you to take a closer look to this broken behavior. Maybe create a PR for that.
“Create event” works fine. “Update event” must work in the same manner, but it doesn’t.
Hi @artildo ,
thanks for the feedback.
I cannot replicate the different behavior bewteen the two nodes. Maybe you can help me replicate that so we can fix it.
What I did:
- set the timezone of my workflow as +6 (just for the sake of testing)
- create a set node that sets start and end dates (starting from the current date and adding days/hours)
- create a Cal event with those start/end dates
- then update the same event using the same start/end dates
What I observe is that the two events (newly created and updated) have the same time (apart from a few seconds between the two executions of the workflow). So it looks to me that Create and Update are handling dates (with timezone) in the same way.
Can you provide more details on how to spot the different behavior?
My workflow for reference:
@giulioandreini I found the pкoblem
I used date in this format: “2023-09-15 22:00:00”
It’s fine for the Event create (timezone is counted).
It’s not working for the Event update (timezone is not counted and added)
But when it’s given in “2023-09-15T22:00:00.000+06:00” format, it’s fine for both. I used Luxon to set dates like that.
So, for date like “2023-09-15 22:00:00” the Update event operation works pretty bad.
Thanks for investigating this further @artildo!
Now it’s clear, the different behavior is there when the timezone is not specified in the ISO date string.
I already created a ticket in our internal system.
Also glad to see you found a solution using Luxon.
All the best