Working with dates question


I am developing a dress rental software… right now I am trying to calculate a date but I am having a hard time to calculate it because i have to miss monday which is the day the store is closed…

Basically the return date of an Item is calculated automatically as the next day of the rental, but the client can pick extra days for his rental. Extra days will charge 10 bucks for each extra day to return the item and automatically calculate the new Return day.

Right now it works for natural days and if return date is monday is throws tuesday…

Basically I dont know how to not count mondays for extra days and

For example…

IF client make a rent on Saturday the automatic return day will be on Sunday, but if he choose 2 extra days the new return date should be Wednesday since we don’t count Monday for the math here since is close…

But right now i have date + extra dates to calculate new return date, that will count monday and thros return date as Tuesday

The client says how many extra days he will need, right now I assume those numbers of days are without including mondays, so for the charge is X numbers of days * 10 bucks…

Any advide will be very appreciated :slightly_smiling_face:

Thanks! Happy sunday!

Within dates, there is the ability to “extract” different components. Specifically, with a date value, you can extract the day of the week.

In programming, days of the week are represented as 0-6, where Sunday is 0, Monday is 1, Tuesday is 3, etc. Here’s how it works in Bubble with the “extract” function.


In this case, you want to search for cases where day = 0. However, what’s a bit tricky is that Bubble doesn’t let you easily search for the “day” value across a range of date (ie. pickup date to return date). (As far as I know, but I welcome other input).

What you can do is to build a “validator” that uses a workflow that reduces the days of rental by 1 if the following rule is met: date_of_rental_return+days -1 extract day = 1, then subtract day from total. (Repeat this general concept 4 (or 5?) times, incrementing the - days count each time).

Hopefully that gives you a few ideas to start. Will follow up if a more elegant idea comes to mind :slight_smile:

Dan (creator of LearnTo - 15+ hours of Bubble tutorials and live coaching)

1 Like

Thanks for the reply bro !!

I will try it today and let you know :slight_smile:


1 Like

To do this i have to use a custom event, right? and use variables as custom states, correct??

Also, in this formula…
date_of_rental_return+days -1 extract day = 1, then subtract day from total.
What u mean with +days-1 extract day?

Thanks my friend!! :smiley: Appreciate it !

On reflection, I think my initial suggestion may be overly complex.

Simple enough, you can have a function that does "If selected return day’s day is 1, then subtract 1 from the total count of days.

If you PM me a link to your application, I’m happy to demo it in a sandbox page.

This topic was automatically closed after 70 days. New replies are no longer allowed.