You are here

protected function FeatureContext::monthsBetweenDates in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Helper function that returns a period between two dates.

Parameters

DateTime $start: The start date.

DateTime $end: The end date.

Return value

DatePeriod The period between two dates

2 calls to FeatureContext::monthsBetweenDates()
FeatureContext::checkUnitPropertyRange in test/features/bootstrap/FeatureContext.php
Checks the state of a unit for a given range of dates.
FeatureContext::iNavigateInTheFullcalendarTo in test/features/bootstrap/FeatureContext.php
@Then /^I navigate in the fullCalendar to "(?<month>[^"]*)"$/

File

test/features/bootstrap/FeatureContext.php, line 412

Class

FeatureContext
Features context.

Code

protected function monthsBetweenDates($start, $end) {
  $period_start = clone $start;
  $period_end = clone $end;
  $period_start
    ->modify('first day of this month');
  $period_end
    ->modify('first day of next month');
  $interval = DateInterval::createFromDateString('1 month');
  $period = new DatePeriod($period_start, $interval, $period_end);
  return $period;
}