Super weird: Cast as DATETIME works in mobile but not web

Hi!

My API provides all datetimes in UNIX. That’s no problem–I just wrap the unix number in DATETIME() and then I can use it like any other timestamp.

Except that I just did a test on the web app and–although it works just fine on mobile–it’s not working on the web. It seems like a pretty unintuitive function to have break just because it’s on a different runtime. Any thoughts about how I can get around this?

Here’s the function:

STRING(FORMAT_DATETIME_WITH_TIMEZONE(DATETIME(params.start_utc), “YYYY-MM-DD”, appVars.current_user.timezone))

As you can see here, the data does show up correctly in the params. And I put an extra text field at the bottom to make sure it was pulling in the timezone like it should:

Here it is working correctly on mobile:

@Harri_Sarsa @Mevi

Hi team! It has been a while since I posted regularly on the forums, and it looks like you’ve had a big influx of activity since then. That’s awesome! In the midst of the growth, is there any chance you’ve had a moment to look at this DATETIME() issue for web apps?

Thank you!

Hi! Yeah, we’ve gotten a lot more forums users which has made the times it takes us to answer issues longer than before :sweat_smile: We’re looking into increasing resources, but are unable to do so right now, so we’ll try to make do in the meanwhile.

Have you made sure the data appears in web? I can see it in the params yes, but does it appear on the page if you just put it as UNIX in a paragraph or as the value in the dropdown for example?

@Mevi

That was a good point about making sure that the data was getting into the page. I tried putting the param into a text field, and it showed up just fine:

Then I tried just wrapping that value in DATETIME(), and they no longer displayed anything.


Just in case the issue was that it had the datetime but didn’t know how to display it, I applied a datetime format. But still nothing.

Ah! I figured it out.

When you pass a parameter, it is always type text. DATETIME needs a number. So wrap it into DATETIME(NUMBER(params.start_utc)) and all should be well.

1 Like

Thank you, thank you, @Mevi !

1 Like