I need to generate Notion employee records on daily basis. I use a date formula formatting “17-07-2022”. Then I suck this data in n8n, applying filter for this date property
Everything went well before I tested I at night, right after midnight. I created records, but n8n found nothing. But if I set filter on yesterday, n8n accepted it. When I created new records in the morning at 11-22 AM, n8n recognized them as today.
So in Notion formulas, if it involves dates, it might looks different for users and for n8n. And this is bad for “Get all”. While I see one formatted date, like 17-07-2022, n8n sees 16-07-2022.
And it can’t be fixed with a timezone setting in n8n, because I pass a string and have no timezone setting in the Notion node.
The one row/page matching the timestamps used in the node is working fine, despite using a different time zone than the n8n timestamp is in (Notion uses 10:31 Europe/Berlin, n8n used 08:30 UTC to 08:32 UTC in this example).
So it would be great if you could elaborate a bit here.
You should test not a Date property in Notion. The problem is in Formula properties, which use some date formulas inside. Let me show you.
So I want n8n to get today’s records. It can’t be done straightforward because Notion offers limited date formats (it has no “DD-MM-YYYY” format). Moreover, for “created time” props you can’t change the format at all.
So I have to add a formula property, format the date the way I need (DD-MM-YYYY).
This formula could be formatDate(prop("created at"), "DD-MM-YYYY")
In n8n the Notion node compares this prop with a string, let’s say, 18-07-2022.
So I have a record where I see the formatted date 18-07-2022 and created at 0:35. I launch n8n with manual filter on this prop against “18-07-2022”.
I expect: see this record as the result I receive: empty
This is completely countrintuitive.
Why it happens? I guess, when n8n Notion node applies manual filter against Formulas based on dates, it takes into accound some Notion timezone settings. And they might tell: “well, from our point of view, this is still yesterday.”
This could be fixed, if the n8n Notion node manual filtering neglected Notion timezone settings.
So the page was created on 27.07.2022 at 0:06 AM. I want to retieve this page based on this date.
I fornat the date to have YYYY-MM-DD and get 2022-07-27.
I pass this condition as a text string, it returns notihing. It works if I pass 2022-07-26 though.
Hi @artildo, with your example I am able to better understand the situation, thanks so much for that! I don’t think this is something that can be handled transparently by the trigger node though.
You can, however, create a string respecting the time zone in n8n though. If you have an ISO timestamp for example, an expression returning the date in a given time zone could look like so:
This expression takes an ISO timestamp on 2022-08-05 and will return the date in the Asia/Seoul time zone, resulting in 2022-08-06 to be returned in the above example.