Handling JSON Date Fields in Bubble: Incorrect Date Displayed as January 1, 1970

Problem Explanation:

I’m working on a Bubble.io project where I need to save date information from a LinkedIn API response directly to my Bubble database. The API returns dates in a JSON format, with separate fields for year, month, and day (e.g., "year": 2017, "month": 11, "day": 0).

I’m using the “Schedule an API workflow” action to save this data directly to the database. However, when the date is saved, it incorrectly shows up as January 1, 1970 in the database. This suggests that Bubble isn’t properly interpreting the separate year, month, and day fields as a valid date format.

It appears that Bubble defaults to January 1, 1970, when it encounters an invalid date or a date it can’t parse correctly.
Screenshot (180)


I’m looking for advice on how to correctly format and save these date components (year, month, day) in Bubble so that the dates are stored accurately in the database. If anyone has experience dealing with similar API responses or has suggestions on handling and combining these date fields in a Bubble workflow, I’d greatly appreciate your insights

You end date is a number, and also start date, i suggest change them to date and then use a arbitrary text inside it add the correct value as you do in date.

If you still stuck, i would love to walk you through

1 Like

Thank you for responding.

But I still get this error after using arbitrary text

Use a server script (for backend workflow) or run javascript (for frontend workflow)

Add this script:
Screenshot 2024-08-14 at 3.53.11 PM

This will create a date. Use step 1’s result in next step.

4 Likes