Problem/Motivation

After creating a monthly calendar in Views, using the pager results in months being skipped over.

Steps to repeat

  1. Add Views Templates module
  2. Add Calendar module
  3. Create content type and add date field
  4. In Views, create a view from a template using the previously added date field
  5. Using the pager on this calendar results in months being skipped over

Expected Results

Site visitor should be able to navigate backwards and forwards through all months without months being skipped over.

Actual Results

Months are skipped over when using the pager and site visitors are unable to use the previous button.

Comments

design_ev created an issue. See original summary.

mpdonadio’s picture

Project: Drupal core » Calendar
Version: 8.2.x-dev » 8.x-1.x-dev
Component: datetime.module » Code

I think this should start in the Calendar module, which is providing the pager in this case?

Andreas Radloff’s picture

THis happends to me when on the 31st of the month. The pages seems to add or subtract 30 days instead of one month so when on October 31 you cannot go to november because the pager points 30 days ahead to Dec 1 and when on July 31 the previous pager points to July 1st. Here's where it happends in class CalendarPager:

  protected function getPagerArgValue($mode) {
    $datetime = $this->argument->createDateTime();
    $datetime->modify($mode . '1 ' . $this->argument->getGranularity());
    return $datetime->format($this->argument->getArgFormat());
  }

Seems to be well known bug judging by the comments here: http://php.net/manual/en/datetime.modify.php

Andreas Radloff’s picture

Status: Active » Closed (duplicate)

Ok this is a duplicate: https://www.drupal.org/node/2737239