Support

Account

Home Forums General Issues How can I filter based on number of days? Reply To: How can I filter based on number of days?

  • I’d imagine instead of saying duration of 3 days, just take the dates and check for posts that have availability on all days in question. So check if a room is available on ALL April 1st, 2nd, and 3rd. If all dates are available then show it.

    Without knowing to much about the project I’d imagine this to check a calendar and just loop through the dates between the start and end dates and check for each day is available on the calendar.

    $desired_dates = array();
    for ($date = $start_date; $date <= $end_date; $date->modify('+1 day')) {
        $desired_dates[] = $date->format('Y-m-d');
    }

    Hope this helps 👍 code is untested