From c9c996536727dc0ee2e35dccfa2a08522470c49e Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Wed, 26 Jul 2017 20:06:39 +0200 Subject: [PATCH] Solved a problem access to first day of the year --- sites/all/modules/calendar/includes/calendar.views.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sites/all/modules/calendar/includes/calendar.views.inc b/sites/all/modules/calendar/includes/calendar.views.inc index 01a9369..475f73e 100644 --- a/sites/all/modules/calendar/includes/calendar.views.inc +++ b/sites/all/modules/calendar/includes/calendar.views.inc @@ -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: