Solved a problem access to first day of the year

This commit is contained in:
Manuel Cillero 2017-07-26 20:06:39 +02:00
parent 2f77223658
commit c9c9965367

View file

@ -19,6 +19,9 @@ function calendar_views_query_alter(&$view, &$query) {
$arg = date_pad(date_part_extract($date, 'year'), 4) .'-'. date_pad(date_part_extract($date, 'month'));
break;
case 'week':
$ww = date_day_of_week($date, DATE_ISO);
$ww = variable_get('date_first_day', 1) ? ($ww == 0 ? 6 : $ww - 1) : $ww;
$date = date('Y-m-d', strtotime("-$ww days", strtotime($date)));
$arg = date_pad(date_part_extract($date, 'year'), 4) .'-W'. date_pad(date_week($date));
break;
default: