I'm running into a problem whereby the next month pager jumps two months. This was exposed after applying the patch for the bug Undefined variable: granularity in date_views_plugin_pager->query(). The pager functionality uses date_modify() to add one month onto next_date, which is set to the last day of the month. According to the php documentation for date_modify(), it takes the date, adds 1 to the month and then checks overflow of days (and presumably months).
So, 31st January 2015 becomes 31st February 2015 which becomes 3rd March 2015 and the pager jumps from January to March.
This might be a php version issue, I'm using php 5.3.29.
I've addressed this by adding 1 month to min_date instead of max_date when the granularity is set to month within date_views_plugin_pager.inc ~ line 285.
if ($argument->date_handler->granularity == 'month')
$this->view->date_info->next_date = clone($argument->min_date);
else
$this->view->date_info->next_date = clone($argument->max_date);
I figure this should always work assuming that min_date is always set to 1st of the month. However, I assume there must be a good reason for using max_date instead of min_date to get the next pager date so guess this will probably break something somewhere along the line. Is this an appropriate solution, is there a better solution or am I barking up the wrong tree?
I assume this issue will also be encountered when skip empty pages is true (which is not the case for me).
Looks like this has been fixed in the latest dev version :)
Comment | File | Size | Author |
---|
Comments
Comment #1
danwonac CreditAttribution: danwonac commentedComment #2
danwonac CreditAttribution: danwonac commentedComment #3
danwonac CreditAttribution: danwonac commentedComment #4
danwonac CreditAttribution: danwonac commentedComment #5
danwonac CreditAttribution: danwonac commentedComment #6
my-family CreditAttribution: my-family commentedI hope the reopening this issue is the right step because I am experiencing exactly the same behavior. However, in my case (7.x-2.9-beta2+9-dev) the problem does not seem to be fixed.
When I want to navigate (Next button) from a month with 31 days to a month with less than 31 days, the pagers skips the "short" month and navigates directly to the next 31-day-month.
Thank you in advance for help.
Comment #7
pwiniacki CreditAttribution: pwiniacki commented@my-family same here.
EDIT: PREVIOUS button is working ok, but NEXT button skip a month with <31 days.
Comment #8
Lostboy22 CreditAttribution: Lostboy22 commentedsee: https://www.drupal.org/node/2375235
Comment #9
Lostboy22 CreditAttribution: Lostboy22 commentedsee fix for -dev version
taging to -dev
Comment #10
jeisel CreditAttribution: jeisel commentedI'm getting this problem, too - and I just updated yesterday.
Comment #11
cafuego CreditAttribution: cafuego commentedClosing as a dupe of #2375235: Calendar block Next/Prev navigation broken (which was filed a little bit earlier).
Comment #12
dstorozhukSame problem here.
Comment #13
Kathode CreditAttribution: Kathode commentedMore testing results: on Android cell using Firefox the Next month button is skipping 1 month going from January to February, then to March. It displays April instead of March. On iPhone using Safari it is skipping forward 1 month from the start of using the Next button. I can't duplicate the skipping problem on desktop browsers.
Comment #14
Michelle@dstorozhuk and @Kathode - This has been marked as a duplicate. You'll want to put your comments on #2375235: Calendar block Next/Prev navigation broken if they are still needed (that one is RTBC).
Comment #15
ianfunghk CreditAttribution: ianfunghk commentedI ran into the same issue now
Comment #16
EgbertB CreditAttribution: EgbertB commentedUpdate to date 7.2-2.x-dev
https://www.drupal.org/project/date
Comment #17
icf-vpathak CreditAttribution: icf-vpathak commentedUpdating the Date module resolved the issue.