Rental Date and Time Constraints - aelassas/bookcars GitHub Wiki

BookCars allows admins to configure rules that control how rental date and time selections behave across the platform. These settings help ensure cars are not booked with unrealistic timeframes or outside of operating hours.

You can also set the minimum rental days for a supplier from the Supplier page in the admin panel. This is described in the last section.

Location

Admin Panel → Settings → Rental Settings

Configurable Options

Setting Description Example
Minimum required time in hours before pick-up Defines how many hours in advance a customer must book a car. Minimum value is 1. 2 → Users can only pick up cars at least 2 hours from now.
Minimum rental duration in hours between pick up and drop off Sets the minimum number of hours required between pickup and drop-off. Minimum value is 1. 24 → A rental must be at least 24 hours long.
Minimum allowed hour for pickup and drop-off Restricts pickup and drop-off to no earlier than this hour (24h format). Minimum value is 0 (midnight), maximum value is 23 (11 PM). 9 → First allowed time is 09:00 AM.
Maximum allowed hour for pickup and drop-off Restricts pickup and drop-off to no later than this hour (24h format). Minimum value is 0 (midnight), maximum value is 23 (11 PM). 19 → Last allowed time is 07:00 PM.

Behavior

  • These settings are applied across web frontend and mobile app.
  • If a user selects a time that violates any of the above constraints, an error message will be shown and the booking cannot proceed.
  • Time pickers in the frontend will automatically restrict the selectable time ranges based on these settings.

Technical Notes

  • These settings are stored in the Setting collection and cached via the Setting context.
  • Backend validations are also applied to enforce constraints regardless of frontend input.

Example Use Case

If the business operates between 09:00 and 19:00, and needs to be at least 2 hours in future for pick up, and a minimum rental duration of 24 hours, the settings would look like:

Setting Value
Minimum required time in hours before pick-up 2
Minimum rental duration in hours between pick up and drop off 24
Minimum allowed hour for pickup and drop-off 9
Maximum allowed hour for pickup and drop-off 19

How Do I Set Minimum Rental Days for a Supplier?

You can set the minimum rental days for a supplier from the Supplier page in the admin panel. This setting ensures that customers can only book rentals that meet or exceed the specified minimum rental period.

If the minimum rental days for a supplier is set to 3, only rental periods of 3 days or more will be allowed. Rental searches with a duration less than 3 days will not display available vehicles from that supplier.

Example:

  • Minimum Rental Days: 3
  • Customer searches for a 2-day rental: No results will be shown.
  • Customer searches for a 3-day or longer rental: Available vehicles will be displayed.