Sometimes it is required to mark the start and end date of a date series (node with from-till date // start - end) graphically.
All we need to to that is a "calendar-date-start" and "calendar-date-end" class for these days, but Drupal 6 Calendar does not provide that!
So I had to find a way and i found! Just use this template preprocess function:
/**
* Create the calendar date box.
*/
function YOUR_THEME_preprocess_calendar_datebox(&$vars) {
template_preprocess_calendar_datebox(&$vars);
$date = $vars['date'];
$date_start = $vars['items'][$date]['00:00:00'][0]->date_start;
if (!empty($date_start) && $date == $date_start->format('Y-m-d')) {
$vars['class'] .= ' webks-calendar-date-start';
}
$date_end = $vars['items'][$date]['00:00:00'][0]->date_end;
if (!empty($date_end) && $date == $date_end->format('Y-m-d')) {
$vars['class'] .= ' webks-calendar-date-end';
}
else {
if (!empty($date_start)) {
$preDay = $date_start->sub(new DateInterval('P1D'));
if (!empty($preDay)) {
$date_end = $vars['items'][$preDay->format('Y-m-d')]['00:00:00'][0]->date_end;
if (!empty($date_end) && $date == $date_end->format('Y-m-d')) {
$vars['class'] .= ' webks-calendar-date-end';
}
}
}
}
}
?>
Important: This only works for "All Day"-Dates, but can easily be modified for other cases, I think.
You can see the results above. Don't forget to add some color lines to your css files, for example:
.calendar-date-start {
background-color: #FFFCBA !important;
}
.calendar-date-end {
background-color: #E1CAFF !important;
}