Hello,
I need to bring a list of array data from an external API into Bubble. The external API response provides timestamps in UNIX milliseconds but Bubble only recognizes timestamps in UNIX seconds so a conversion is needed. The API response appears in this format:
[
{
id: 1
created_at: 1654006395850
description: “Description 1”
},
{
id: 2
created_at: 1653875682508
description: “Description 2”
}
]
I have been using the secondsToDate plugin in other sections of the app. Since Bubble only recognizes UNIX timestamp in seconds, and the external API provides timestamps in UNIX milliseconds, I use the plugin to convert to UNIX seconds (which Bubble prefers) by dividing by 1,000 (hint: I pull the datetime fields into Bubble as a number to make it possible to divide by 1,000).
I’ve realized that when I use the plugin on API responses where the datetime field isn’t nested, the plugin works just fine. But when the datetime field is nested within an object in the response (as is the case with created_at above), the plugin doesn’t work. In such situations, when I divide by 1,000, it doesn’t display anything at all on the preview page. But when I don’t divide by 1,000, it displays on the preview page like the picture below:
Any assistance on how to deal with this problem will be greatly appreciated, even if it requires another solution other than the plugin I’m currently using.