function availability_calendars_month_meta in Availability Calendars 5
Same name and namespace in other branches
- 6.2 availability_calendars.inc \availability_calendars_month_meta()
- 6 availability_calendars.module \availability_calendars_month_meta()
- 7.2 availability_calendars.inc \availability_calendars_month_meta()
2 calls to availability_calendars_month_meta()
File
- ./
availability_calendars.module, line 297 - Availability Calendars Module
Code
function availability_calendars_month_meta($year, $month, $startofweek) {
$month_meta['daysinmonth'] = date("t", mktime(0, 0, 0, $month, 1, $year));
$month_meta['firstday'] = date("w", mktime(0, 0, 0, $month, 1, $year)) + $startofweek;
$tempDays = $month_meta['firstday'] + $month_meta['daysinmonth'];
// padding
$month_meta['weeksinmonth'] = ceil($tempDays / 7);
// Stop empty weeks occuring at start of month
if ($month_meta['firstday'] > 6) {
$month_meta['firstday'] = $month_meta['firstday'] - 7;
$month_meta['weeksinmonth']--;
}
return $month_meta;
}