Forum Academy Marketplace Showcase Pricing Features

Figuring out logic for booking system

Hi all,

I’m building a booking system that works like this:

1.) The property owner sets a minimum contract length, e.g. 3 months and ‘availability date’

2.) The renter can then book the property for 3+ months, so when they fill in the booking form, they select both move-in date + move-out date. The move-in date must be FROM the availability date set by the property owner, and the move out date must be 3+ months away (or whatever the minimum contract length is) AND on the same day as the move-in date (e.g, if the user moves in on 3rd March, they must ‘move out’ on the 3rd of whatever month their move-out date is).

Can I use the date picker for this? Can I get it working as described above?

Thanks :slight_smile:

Yes, you can take a date and apply a maths operation on it and then check another date to see if it is before or after that date. This would tell you if it is valid.

If you take a look at this demo, you can see the 2 date pickers. Imagine these were the Owner and the Renter dates. you can see if the datediff is + or - result to check the validity.

Hi Dave,

OK thanks - looks like I can build it then. Will probably rope in a little help when I put it together.

Just to re-iterate functionality (I couldn’t quite tell how the demo would relate, other than the date pickers)

Owner selects the move-in date from a date pickers. They also select the minimum contract length from a dropdown (1 month, 2 months, 3 months, 6 months, 12 months).

The renter will then only be able to select a move-in date after the move-in date selected by the owner, and will not be able to choose a move-out date earlier than the minimum contract length.

Thanks

Yep, that’s doable. if you look at the date operations you have day add etc.

You will probably need a couple of custom states to help with your logic checks etc.

1 Like

Ok, thanks Dave!

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