Forum Academy Marketplace Showcase Pricing Features

Date range arithmetic and parenthesis function

Seems like I can’t add 1 month to an end date, within a date range. (I can only do arithmetic on the start date)

This is an API workflow, so I can’t use custom states to store intermediate values.

A lot of limitations like this within the Bubble composer (is this what it’s called?). For a start, a parenthesis function would help greatly. Rather than making the order of operation strictly sequential.

No, but you can create a Parameter to hold the value

Make a Parameter called “start date” and have it be a type date and a Parameter called “end date” and make it a type date

When you schedule the backend workflow set the date Parameter values

1 Like

Thanks! I’ll try that.

But I’m wondering if it’s safer to have 2 fields instead - start date and end date.
In case I need to manipulate the dates in future, and it’ll be harder to do it on a date range?

Might be. Still possible to do, so I guess just a personal choice.

1 Like

Thanks! I guess I’ll play it safe and have 2 fields.

Hello there!

I am having this exact same issue. It seems silly to me that you can’t simply add hours (etc.) on both sides of the range operator.

I am a no-coder, so I struggle with terms that are not bubble’s “language”. What exactly do you mean by parameter in this instance? I take it you mean, set a value somewhere else that can be used in the expression. How would I do this though? Put an invisible input on a page that’s value is used?

Also, I’ve looked around quite a bit here in the forum. Haven’t you created an entire booking/scheduling template? That has got to be ridiculous/painful to do work arounds for an entire template.

Same issue for me here. Did you end up using fields? If so, how did you accomplish this?

I ended up using 2 date fields. Easier to perform any arithmetic.

1 Like

Parameter is Bubble language. It is part of the backend workflows “AKA API workflows”

I would make a parameter called ‘start date’ and have it be a type data and a Parameter called ‘end date’ and make it a type data. When scheduling the backend workflow I would set the date parameter values.

I have. There are a couple of my templates that use the same scheduling function I put together for the Calendly Clone Template.

I wouldn’t consider them necessarily work arounds as it is just really working within the system Bubble has built. But yes, creating a functional booking/scheduling application that can do everything necessary for a production grade scheduling application including timezone aware is challenging.

1 Like

Maybe you can help me with this. It seems to be easy but I can’t get it to work.

I am trying to build a service app for my company. I have a recursive backend workflow that creates generates a date type called “day” each day 30 days out (I wanted to limit bookable days to 30 days out). This data type “day” has a field called “availability” that is a list of date ranges. When the “day” is generated there is only one date range -which is the whole service day’s availability. My plan is to have these date ranges manipulated by scheduled jobs thus changing/limiting availability.

When a client wants to book a service. I want to have a RG search “Days” and then filter “Day” by “availability” contains the estimated duration of the service (filter because you can’t use a list of Date Ranges as a constraint during a search) . Once the “day” is selected date ranges that are large enough to contain the job’s estimated duration would be shown. Then when the job is booked the date range is manipulated to close availability.

I guess I have these questions:

  1. Is it possible to manipulate a date range (split, shorten, or other).
  2. Can a date range only contain another date range or date?
  3. Is it possible to filter a data type (in this case “day”) by using a constraint that is a date range (“availability”) that “contains” an estimated duration.
  4. What data type should the estimated duration be to make this work if possible? (date range, date interval, numeric range, or other). I assumed date interval would be the one but I cant get it to work.

Yes it is.

It can be both

I would imagine it is. Just needs to ensure things are setup properly to do so. If the ‘Day’ is a date it is possible. If the ‘Day’ is a date range it is possible.

Duration is a number, so an integer.