Help

Re: Date discrepancies between grid via and script output

Solved
Jump to Solution
1318 1
cancel
Showing results for 
Search instead for 
Did you mean: 
nefiger
6 - Interface Innovator
6 - Interface Innovator

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!

1 Solution

Accepted Solutions
TheTimeSavingCo
17 - Neptune
17 - Neptune

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:

Screenshot 2023-02-22 at 11.47.34 AM.png
+8 formula:

DATEADD(
  Date,
  8,
  'hours'
)

-8 formula:

DATEADD(
  Date,
  -8,
  'hours'
)

Link to base

See Solution in Thread

4 Replies 4
TheTimeSavingCo
17 - Neptune
17 - Neptune

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:

Screenshot 2023-02-22 at 11.47.34 AM.png
+8 formula:

DATEADD(
  Date,
  8,
  'hours'
)

-8 formula:

DATEADD(
  Date,
  -8,
  'hours'
)

Link to base

@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!

nefiger
6 - Interface Innovator
6 - Interface Innovator

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 🙏

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!