diff --git a/date_api/date_api.module b/date_api/date_api.module index 2a973cc..288a8f3 100644 --- a/date_api/date_api.module +++ b/date_api/date_api.module @@ -2075,9 +2075,11 @@ function date_iso_week_range($week, $year) { date_timezone_set($min_date, date_default_timezone_object()); // Find the first day of the first ISO week in the year. + // If it's already a Monday, date_modify won't add a Monday, it will remain the same day so add a Sunday first, then a Monday + date_modify($min_date, '+1 Sunday'); date_modify($min_date, '+1 Monday'); - // Jump ahead to the desired week for the beginning of the week range. + // Jump ahead to the desired week for the beginning of the week range if ($week > 1) { date_modify($min_date, '+ ' . ($week - 1) . ' weeks'); } diff --git a/date_views/includes/date_views_plugin_pager.inc b/date_views/includes/date_views_plugin_pager.inc index 5caca4e..1addd20 100644 --- a/date_views/includes/date_views_plugin_pager.inc +++ b/date_views/includes/date_views_plugin_pager.inc @@ -281,7 +281,7 @@ class date_views_plugin_pager extends views_plugin_pager { else { $this->view->date_info->prev_date = clone($argument->min_date); date_modify($this->view->date_info->prev_date, '-1 ' . $argument->date_handler->granularity); - $this->view->date_info->next_date = clone($argument->max_date); + $this->view->date_info->next_date = clone($argument->min_date); date_modify($this->view->date_info->next_date, '+1 ' . $argument->date_handler->granularity); } // Write the date_info properties that depend on the current value. diff --git a/date_views/theme/theme.inc b/date_views/theme/theme.inc index 9e7debc..7ca03f3 100644 --- a/date_views/theme/theme.inc +++ b/date_views/theme/theme.inc @@ -77,7 +77,7 @@ function template_preprocess_date_views_pager(&$vars) { switch ($granularity) { case 'week': $prev_week = date_week(date_format($prev_date, 'Y-m-d')); - $prev_arg = date_format($prev_date, 'Y-\W') . date_pad($prev_week); + $prev_arg = date_format($prev_date, 'o-\W') . date_pad($prev_week); break; default: $prev_arg = date_format($prev_date, $format[$granularity]); @@ -90,7 +90,7 @@ function template_preprocess_date_views_pager(&$vars) { switch ($granularity) { case 'week': $next_week = date_week(date_format($next_date, 'Y-m-d')); - $next_arg = date_format($next_date, 'Y-\W') . date_pad($next_week); + $next_arg = date_format($next_date, 'o-\W') . date_pad($next_week); break; default: $next_arg = date_format($next_date, $format[$granularity]);