Date Range Datatype and API Connector

Has anyone ever successfully retrieved a DATE RANGE datatype from the API Connector? It’s unclear to me what sort of JSON structure Bubble needs to see to be able to import that object as a Date Range.

If so, could someone provide an example of the raw JSON data that can properly be interpreted as a single date range object?

As an example of what does not work: A range constructed by moment-range will come across as JSON like this:

  "daterange": {
                "start": "2013-09-09T07:00:00.000Z",
                "end": "2013-09-11T07:00:00.000Z"

But this is not perceived as a date range by Bubble. The API Connector interprets it like this:

I do know how to construct a Bubble-style date range in JavaScript using Toolbox (as @mishav explained to me, it is like this):

However, I’ve not been able to construct the correct JSON that Bubble would expect for one of its own “date range” objects. All of my various attempts do not yield a correct interpretation by the API Connector.

Just a little bump here:

Based on what I know about date range, we might think that the JSON for this would be something like:

“daterange”: [“2010-02-01T08:00:00.000Z”,“2018-08-30T18:13:37.638Z”]

That is, basically a 2 element list of dates, right? But if you send this from an API and then tell Bubble that this is a date range, it does not interpret it that way.

Basically, there’s no way to “guess” the right answer here. Just wondering if anyone’s ever stumbled across it…

My guess:

For the API result parser, it would be too big an assumption to create a date range type automatically, as next time it runs it could be a list of three dates instead of two.

As for the manually setting of the date range type, it complicates the UI because it would be condensing a structure containing a type, into a single type. So it will be interesting to see how Bubble achieves that, if they decide there is a need for it.

Point is that API Connector offers this as an option… but I can’t figure out if it ACTUALLY
can be selected successfully. Everything results in a malformed range inside of Bubble. Grumble.

Sounds like a case for Super Investigator! (bug report)

1 Like

Yeah, seems to be an undefined sort of condition. (i.e., a feature that is not finished.)

Just to be clear, the API I’m talking about is my own. I wrote it and can edit it. I KNOW the thing it’s sending is meant to represent a date range. I just can’t deliver it in any JSON form that Bubble seems to understand. (I’ll file a bug report/question about this and let ya know the answer!)

1 Like

Hello @keith, any update on this? I’d be interested in knowing how Bubble manages date range data types.

I’m actually trying to send a date range via api call (actually Bubble App Connector), and I can’t figure out how to send an array of date range. The end side is a Bubble app, whose API expects an array of date range.


@miguel @keith
More news from this side ?

I find it a bit strange that nested arrays don’t seem to be a thing with bubble but when retrieving the data is shows date ranges as nested arrays?