Feb 21, 2023 01:50 AM
Hi smarter people than me, I hope you can help?
I have an integration with CraftMyPDF where I send a payload I build in script through to be used to populate the PDF template. 2 of the fields passed through are date fields: Contract date and Event date. I have noticed that these fields are always offset by 1 day in the past.
In the base grid view (or any other Airbase view or interface) these dates reflect accurately, as captured. When I use these same fields in my payload and inspect it, they reflect with -1 offset.
The dates are formatted "friendly" and set to my local timezone.
Does anyone have any suggestions on how to get the API to honour the date as it is shown in grid views?
thanks in advance!
Solved! Go to Solution.
Feb 21, 2023 07:48 PM
I believe you're going to have to create a new formula field with `DATEADD()` to match your current timezone and use that formula field instead I'm afraid:
+8 formula:
DATEADD(
Date,
8,
'hours'
)
-8 formula:
DATEADD(
Date,
-8,
'hours'
)
Feb 21, 2023 07:48 PM
I believe you're going to have to create a new formula field with `DATEADD()` to match your current timezone and use that formula field instead I'm afraid:
+8 formula:
DATEADD(
Date,
8,
'hours'
)
-8 formula:
DATEADD(
Date,
-8,
'hours'
)
Feb 22, 2023 12:11 AM
@TheTimeSavingCo thank you!
I struggle to grasp how data can be displayed one way and then when used programmatically just ignore any formatting previously applied and not have any mention or flags on documentation (or perhaps I just missed those and am grumpy for needed to rework and create workarounds for something that is solved on the frontend but ignored on the backend).
Nevertheless, thanks for the pointer. Have a fab day!
Feb 22, 2023 12:23 AM
And it's just 2 measly hours giving me this runaround - I'm GMT +2 🙈
Happy to report (yet another) date field added, now with timezone fancy footwork. Thanks @TheTimeSavingCo 🙏
Feb 22, 2023 04:53 AM - edited Feb 22, 2023 04:53 AM
It being GMT +2 makes it a pretty great catch on your part; I could imagine myself going months not noticing that that was happening heh
Glad I could help!