Issue with date field from api

Hello folks,

I’m having an issue with a date field from API, when I call API the content of date is bellow:

In a repeating group is like this:


but in the page is presented like bellow:


How could I adjust this to the correct date: 20/01/2022

I appreciate your help.

R. Lima.

Bubble expects that to be in milliseconds but it looks like it’s in seconds for you. That’s why you’re getting a time in 1970. One way to do it would be to bring in that value as a number and multiply it by 1000 and then convert that number into a date

I have a plug-in element that turns seconds into a date if that would be helpful for you. It’s free

I don’t think the date is in second but I think the date doesn’t have any delimiter and Bubble is unable to parse it. So what we see in the screenshot is 2022-01-20. Adding 1000 will not help and Bubble will not be able to parse it.
I think you may need to get is as a text and probably convert it to date. You can also use a regex function or split by to set the display of the date in the way you want it (but always set the API Connector to text and not date).

Thanks @jared.gibb and @Jici for your help, but anyone could make a example for the solution?

R. Lima.

Hi @rafael.alima :wave:

I created a custom state caled “date_text” in my index page and set its value to “24012022”.

Note that I am in Brazil and we use the format DD/MM/YYYY

I used Java Scrpit to split, format and organize the text as Date.

var my_year = index's date_text:truncated from end to 4:converted to number
var my_month = index's date_text:truncated from end to 6:truncated to 2:converted to number - 1
var my_day = index's date_text:truncated to 2:converted to number
var my_date = new Date(my_year, my_month, my_day);
console.log (my_date)

The result:


Did you have any experience with the Tool Box plugin?
You can use it to extrat the result of any JavaScript code into Bubble.

Hope it help!


Hello @rpetribu :wave:

Thanks for your support.

Nice example!

This topic was automatically closed after 70 days. New replies are no longer allowed.