Change the second date in a date range

Why isn’t it possible to change the second date in a date range? It only allows me to change the first date in the expression.

Editor: Oresundsflytt | Bubble Editor

1 Like

Boosting this request as I recently ran into the same issue!

In the meantime though, I was able to get around it for now in my case by creating the start and end date/times separately (with the appropriate changes), then referring to those newly created date/times for the range operation.


Kevin
AirDev

We’re looking for Bubble developers to join our team: https://jobs.airdev.co/

2 Likes

+1. I do something like @kevin12 but I just calculate :end in a state since you can do maths on the :start of the range. Performance différence négligeable between the two.

1 Like

Yeah, that’s one solution. That doesn’t work in the api section though. If I were to calculate the end date in this expression (in the api section):

Skärmavbild 2020-01-23 kl. 17.55.39
I would have to save a start and an end date as two separated fields and change them first and then refer to them. Am I right?

@kevin12 @duke.severn

If your date can be calculated at call time, you can can add a “key” (.i.e: api_endtime, type:date) and send the value. Then go

First part of expression < range > api_endtime.

If your date is reliant on data changes within the actual API workflow, you can add a “temporary” data field in the database and change it within the workflow. Just make sure to use 2-step wf.

  1. Make changes to thing’s “temp_endtime” (endtime+days [whatever you need]
  2. Make changes to result of step 1’s datum_range first part of expression < range > result of step 1’s temp_endtime

The “result of step 1” is just to force Bubble to run it in series and make sure it catches the calculated value and not the original.

Let me know if that makes sense.

Thank you! Your answer cleared things up. This seems to work: