How to manipulate the way bubble detects Date Format

Currently iam making a Api call wich returns date format like dd/mm/yyy
But bubble detects this as mm/dd/yyyy.

Wich wil be wrong in my case when the returned values i get is 01.02.2020= 1.february 2020 and bubble detects this as 2.january 2020.

Is there any workaround for this?
thanks.

I remember facing this issue too. But end up with no solution and I had to educate my users using MMDDYYYY

The issue here is that this is a pretty poorly designed API (e.g., in addition to the fact that this date representation is ambiguous, it even looks like there’s an extra space in that first “date” that is not present in the second “date”).

So what happens here is that Bubble’s date parsing, which just relies on JavaScript is doing something like:

image

Which is pretty much the best it can do.

You could consume those fields as text and then do the parsing yourself (which would involve a bit of code) either in-page (if that’s acceptable for your application – probably not) or in a server-side workflow (which probably is something you don’t want/need to do either).

It’s possible that this API was designed such that the “dates” are not intended to be consumed as date objects but as text, but they are not particularly web-friendly, are they? :man_shrugging:

2 Likes

Thank you for your answer keith,

One thing that is for sure is dates are important part of this API since this API is sending me meter readings for electricity usage and the whole idea of this app iam building is to compare electricity usage for different dates.

When it comes to the design of this particular Api it goes like this:

  1. I get meter readings as a CSV file from the energy company ( they will have their own api soon)
    2.I uploaded to google sheets
    3.I used https://sheet.best/ to convert it to Json api

So design flaw could have come at one of the points above.

Here is how i receive the meter readings

Well, in this case, you could transform the data before you send it to SheetBest, or perhaps can transform it there?

1 Like

I did that now it works,thanks:)

1 Like

Cool. Glad that helped. BTW, if you’re in contact with anyone at your power company involved in designing their REST API, put in the request that they expose the date fields in ISO 8601 format (which is probably what they would do, but it never hurts to suggest!) and that would alleviate this problem when you move to getting this data directly from their service via API calls.

1 Like