# Calendar Calculations and Availability

**URL:** <https://forum.bubble.io/t/calendar-calculations-and-availability/77491>\
**Category:** Need help\
**Created:** [January 28, 2020, 4:03pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491 "2020-01-28T16:03:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dramirez](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dramirez](https://forum.bubble.io/u/dramirez)\
**Post date:** [January 28, 2020, 4:03pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/1 "2020-01-28T16:03:16Z")

</div>

I searched through the forum for info but I couldn’t really find a straight answer.

I am trying to calculate the number of days between two date inputs. I am aware of the “range” feature but I couldn’t figure out how to calculate how many days are in that range.

To add to that question, I am trying to figure out a way that when a listing is booked, those dates become disabled on the date picker inputs for future bookings, marking the listing as unavailable for those dates.

Does anyone have any experience with this?

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [January 28, 2020, 4:39pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/2 "2020-01-28T16:39:42Z")

</div>

To get the number of days between two dates, you can subtract the start date from the end date and format the result as days.

If you are using the Air Date/Time Picker plugin, you can block dates based on certain criteria. So, I’m thinking you could search through your listings and block the dates that have already been saved.

Hope this info helps to get you down a good path.

Best…  
Mike

---

<div class="post-metadata">

**Author:** ![dramirez](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dramirez](https://forum.bubble.io/u/dramirez)\
**Post date:** [January 28, 2020, 5:53pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/3 "2020-01-28T17:53:58Z")

</div>

Thank you, that did work initially.

The problem is that it is giving me half days, which I’m guessing has to do with the time input even though the input is only capturing date. Is there any way to just capture date with this field and not time?

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [January 28, 2020, 5:56pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/4 "2020-01-28T17:56:51Z")

</div>

When you save the date, you can change hours, minutes, and seconds (each individually) to 0. See if that does the trick for you.

Best…  
Mike

---

<div class="post-metadata">

**Author:** ![dramirez](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dramirez](https://forum.bubble.io/u/dramirez)\
**Post date:** [January 28, 2020, 7:00pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/5 "2020-01-28T19:00:19Z")

</div>

At what point in the equation can I do that? Right now I have it set up as seen below, but it only lets me change the hours, minutes, seconds, for the first value in the equation:

![Bubble4](https://us1.discourse-cdn.com/bubble/original/3X/0/6/06bb8604d0680a28ba68840b8754fdb3a470846e.png)

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [January 28, 2020, 7:27pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/6 "2020-01-28T19:27:16Z")

</div>

Yeah, I think I remember that now. I believe when you change the hours, minutes, and seconds to 0 on the first date, it just works. Does it appear to be working correctly for you?

---

<div class="post-metadata">

**Author:** ![dramirez](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dramirez](https://forum.bubble.io/u/dramirez)\
**Post date:** [January 28, 2020, 7:38pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/7 "2020-01-28T19:38:32Z")

</div>

It was still giving me the half days when I did it like that. But I did have the initial content on the Date Picker set to Current Date/Time, so I just changed hours to 0 in that section and it appears to work. Thanks for the help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [April 7, 2020, 4:03pm UTC](https://forum.bubble.io/t/calendar-calculations-and-availability/77491/8 "2020-04-07T16:03:21Z")

</div>

Closed on April 7, 2020, 4:03pm UTC

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