Date View pager navigation for month based views advancing incorrectly.

#53 i2375235-53.patch1.66 KBJelle_S
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View
#35 calendar_pager_broken-2375235-35.patch867 bytesrsmylski
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View
#26 2375235_calendar-pager_not_advancing-25.patch1.15 KBLostboy22
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View
#23 2375235_calendar-pager_not_advancing-23.patch962 bytesLostboy22
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View
#19 2375235_calendar-pager_not_advancing-19.patch881 bytessteinmb
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View
#10 2375235 calendar pager not advancing.patch1.1 KBLostboy22
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2375235%20calendar%20pager%20not%20advancing.patch. Unable to apply patch. See the log in the details link for more information. View
Members fund testing for the Drupal project. Drupal Association Learn more


spiritcapsule’s picture

Ran into the same issue. Replicated issue on with Date 7.x-2.9-beta1 and default recommended versions of Core, Calendar, Views, and CTools.

dhalbert’s picture

Title: Calender block AJAX navigation broken » Calender block Next/Prev navigation broken

Changed title: also fails with non-Ajax navigation. The links in the Next and Prev buttons link to the current month.

The year view has the same problem as well.

bezu60’s picture

I'm having the same issue. And I don't even know what all of those attempted fixes mean. Is there a safe way to go back to a previous version? Will there be a patch?

And how do I revert back. I'm pretty green...any help appreciated.

dhalbert’s picture

Title: Calender block Next/Prev navigation broken » Calendar block Next/Prev navigation broken

@bezu60: You can git clone the Date repo, and checkout the 7.x-2.9-alpha2 version. But that requires some skills you'll have to learn, and is most easily done if you have command-line access to your site. There are tutorials - I'm sorry it's not so easy.

bezu60’s picture

I have no idea how to do that or time to learn it right now. Do you think there will be a patch?

bezu60’s picture

I was able to fix this easily by going back to the alpha version. You can find it here: Thanks to Vijay!!

I just deleted the Date Module and uploaded this one and everything is fine.

They should get rid of that beta release until it works properly.


bezu60’s picture

Nevemind :)

kwfinken’s picture

Version: 7.x-2.9-beta1 » 7.x-2.9-beta2

I am still seeing the issue on 7.x-2.9-beta2+1-dev. Any chance this patch is going to be rolled in soon?

You can see the issue at

Lostboy22’s picture

Version: 7.x-2.9-beta2 » 7.x-2.x-dev
Issue summary: View changes
1.1 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2375235%20calendar%20pager%20not%20advancing.patch. Unable to apply patch. See the log in the details link for more information. View

moving to dev version, adding patch
This will also fixes Undefined variable: granularity line 283, 285 of date_views/includes/

Lostboy22’s picture

Status: Active » Needs review
keva’s picture

Status: Needs review » Reviewed & tested by the community

patch appears to fix this issue

gfury’s picture

Patch worked for me (core 7.34, calendar 7.x-3.5, date 7.x-2.9-beta2)

Thanks !

rwilson0429’s picture

Thanks Lostboy. The solutions you provided in #10 works for me. It also fixed the issue at

webadpro’s picture

Please commit.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: 2375235 calendar pager not advancing.patch, failed testing.

steinmb’s picture

Patch not longer apply and need to be re-rolled.

git apply -v 2375235\ calendar\ pager\ not\ advancing.patch
Checking patch date_views/includes/
error: while searching for:
        else {
          $this->view->date_info->prev_date = clone($argument->min_date);
          date_modify($this->view->date_info->prev_date, '-1 ' . $granularity);
          $this->view->date_info->next_date = clone($argument->max_date);
          date_modify($this->view->date_info->next_date, '+1 ' . $granularity);
        // Write the date_info properties that depend on the current value.
        $this->view->date_info->year = date_format($argument->min_date, 'Y');

error: patch failed: date_views/includes/
error: date_views/includes/ patch does not apply

patch -p1 < 2375235\ calendar\ pager\ not\ advancing.patch
patching file date_views/includes/
Hunk #1 FAILED at 280.
1 out of 1 hunk FAILED -- saving rejects to file date_views/includes/
steinmb’s picture

Status: Needs work » Needs review
881 bytes
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View

Have a look at this commit:

commit 139892032014e6e0d6500850b37679603abec236
Author: vijaycs85 <>
Date:   Fri Mar 27 12:37:04 2015 +0200

    Issue #2372073 by vijaycs85, Lostboy22, maximpodorov, stefan.r: Undefined variable: granularity in date_views_plugin_pager->query() (line 285 of //modules/date/date_views/includes/

Did this commit render this issue a duplicate? I think this issue need to be re-tested with and without this patch.

Jody Lynn’s picture

The patch that went in half-way fixes it. But the issue remains that in March the next month is still being shown as May (because April has no 31st and the pager is still being calculated based on the end date)

See also #2422539: Date pager Prev Next links point to the same date on Calendar which is the same issue but a slightly different approach.

pwiniacki’s picture

@Jody Lynn, I can confirm that, I have exactly the same issue.

steinmb’s picture

Thanks for testing. The patch in #19 contain what did not get committed. Does this fix this issue? Have anyone tested it?

Lostboy22’s picture

962 bytes
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View

Lets try this patch. Only "Next" not working at this point.

my-family’s picture

What should be tested? #19 with #23 together? Or #23 only?

#23 did not help, the "Next" link is still wrong.

#19 - pager points always to the same month

Lostboy22’s picture

10 failed because fixing two issues at once. The granularity issue and the advancing issue.
19 "Next" cloned..previous_date, so date_modify +1 will point to current month, needed +2 for date modify
(will "hide" from summary)
23 trying a simpler approach, [may need to confirm $argument->max_date is always set]

just 23, try it on a clean copy of date-7.x-2.9-rc1.
Let me/us know the following if you still have problems.
Which version of PHP?
Are you using Calendar (what version?) or date pager for another view?
Are you using an account that "remembers" previous value?

Lostboy22’s picture

Issue summary: View changes
1.15 KB
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View

The skip_empty_pages applies granularity when calculating the prev/next argument. We'll do the same when not skipping empty pages. Just the provided $argument->argument from views.

my-family’s picture

On the clean copy of date-7.x-2.9-rc1:
#23 did not help, #25 solved the problem.

@Lostboy22, thank you!

chiebert’s picture

#26 Applies cleanly to date-7.x-2.x-dev (March 27 2015) as well as 7.x-2.9-rc1, and addresses the pager link issues for both month views when the month has 31 days, and the occasional week views.

zombree’s picture

#26 worked for me, using date 7.x-2.9-rc1+1-dev.

rwilson0429’s picture

#26 worked perfectly well. I applied the patch in #26 to the latest 7.x-2.x-dev (2015-May-06).

Thank you very much Lostboy22.

e.ruiter’s picture

I applied the patch in #26 but now the week pager is broken when switching to week tab, for example: when on week/2015-W28 the next pager is also week/2015-W28, so I can not navigate to next week.

Date version: 7.x-2.9-rc1+2-dev
Calendar version: 7.x-3.5

misthero’s picture

26 works for months perfectly it was skipping September before patching

perlgal’s picture

I applied the patch #26 that fixed the month pager but like @e.ruiter reported, it broke the week pager.

steinmb’s picture

Status: Needs review » Needs work

If the week pager broke then, needs work

rsmylski’s picture

Status: Needs work » Needs review
867 bytes
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View

I tried using min_date when doing the next_date calculations and it has been working for me with the different granularity options.

RobertInOP’s picture

#35 works for me in the months pager. Date version: 7.x-2.9-rc1 and Calendar version: 7.x-3.5

vikramy’s picture

#35 works me too on 7.x-2.9-rc1 version. Thank you rsmylski

bezu60’s picture

#35 worked for me. Thanks!

John Bickar’s picture

Status: Needs review » Reviewed & tested by the community
samstamport’s picture

I applied the patch in #35 to 7.x-2.9-rc1, but it does not work. Is there another patch I need in addition to #35?

When I go from Sept. 2015 it correctly advances to Oct. 2015, but when I click for Nov. it skips to Dec.

Please help.

steinmb’s picture

@perstam the patch have to be applied to 7.x-2.x-dev

samstamport’s picture


I'm using the Open Outreach distribution. I'll create a problem report there since updating the Date module has so many dependencies.

Vali Hutchison’s picture

Applied Patch in #35 to Date 7.x-2.9 and fixed next skipping a month.

pivica’s picture

Applied patch from #35 and this also fixed skipping next skipping a month.

rgchi’s picture

Will this patch be included in a release soon?

Rob_Feature’s picture

#35 works for me as well....

joelstein’s picture

#35 works for me. Thanks!

mxh’s picture

I can confirm that patch from #35 fixed this problem with current version 7.x-2.9. Don't know if this works with current dev though. Maybe can someone test it out with dev, so we can mark this as RTBC.

Many thanks to rsmylski (again), I appreciate your contributions a lot.

nikathone’s picture

adding another related issue which has a different patch may.

samstamport’s picture

I am using the Open Outreach distribution. They have incorporated this patch into their latest release. It works!

Jelle_S’s picture

Status: Reviewed & tested by the community » Needs review
1.66 KB
PASSED: [[SimpleTest]]: [MySQL] 5,337 pass(es). View

Uploading my patch from #2580809-3: Pager returns 2 months later in month view here as well since it was marked as duplicate.

I made a patch that I think is a bit more robust.

date_modify($date, '+1 month') takes the '+1 month' a bit too literally. For example:
If $date is 31 January 2015 and you add one month to it:
date_modify($date, '+1 month');
PHP tries to set the date to 31 February 2015, but there are only 28 days in February 2015, so the resulting date is 3 March 2015.
In this patch the pager goes to the first of next month (=> +1 day), which is 1 February 2015. Then it gets the number of days in this month (which for February 2015 is 28) and sets the date to that (28 February 2016). This will work for every month, leap year or not.

rsmylski’s picture

Status: Needs review » Reviewed & tested by the community


Thanks for your patch, it essentially does the same thing as my patch. However, with my patch, there doesn't need to be any added checks or conversions. By using $argument->min_date, you get a date that is at the first of the month, and the beginning of any time frame to make the date math work.

Marking back as RTBC with the patch from #35

dobe’s picture

+1 to RTBC patch #35 once I investigated I solved the issue with the same code. But this issue queue already existed!

dasginganinja’s picture

+1 to RTBC patch #35

This just fixed my calendar paging issue.

cudevdev’s picture

+1 to RTBC patch #35.

andrewtf’s picture

+1 to RTBC patch #35!

Alperian’s picture

#26 worked for me. #35 didn't do anything

phandolin’s picture

Thank you! The patch from #35 worked for us as well. +1 to RTBC

lsabug’s picture

Patched current dev version (100515) of date with #35 using Drupal 7.41 and fixed skipping month issue

chandraswami’s picture


#35 did the trick!

Using Core-7.41, Calendar-7.x-3.5, Date-7.x-2.9.

I used patch in #35 and it fixed the Pager-{time-period}-Skipping issue for the Month, Week, Day and Year. This should get rolled into the Date_Module soon.

Hats off to rsmylski.

dstorozhuk’s picture

#35 did the trick for me also, but:

by @danwonac in #2393191: Next month pager skipping months

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.


It would be great if someone who contributed this lines $this->view->date_info->next_date = clone($argument->min_date); (284) to sites/all/modules/contrib/date/date_views/includes/ can clarify if we can use min_date here.

travelertt’s picture

Patch #35 works for me as well.

dasginganinja’s picture

@podarok What needs to be done about getting this live? I've started a new website and have again had to patch date module. Mind you this is all done with a Drush Makefile so it's automated, however with the recent date release it would be great to see this get updated. All we want is one cherry-picked patch :)

jbabiak’s picture

Patch #35 work for me, lets get this committed.

aderama’s picture

Patch #35 worked for me too. I could not see any negative effect on it.

.bert’s picture

Patch #35 works for me too. Thanks @rsmylski

BBC’s picture

Patch #35 fixed this for me as well. Please commit.

tsokura’s picture

Patch in #35 worked for me too, with core 7.41, Calendar-7.x-3.5, and Date-7.x-2.9.

Kathode’s picture

When using core 7.41, Date-7.x-2.9, & Calendar-7.x-3.5, a calendar view that is displayed on a Smartphone browsing with Firefox or Safari has a problem with the Next month pager skipping months. When navigating from February to March, it skips a month and displays April. Desktop usage doesn't seem to have this issue. I've not applied patch #35.

  • cafuego committed c388ec7 on 7.x-2.x authored by Jelle_S
    Issue #2375235 by Lostboy22, steinmb, rsmylski, Jelle_S: Calendar block...
cafuego’s picture

Status: Reviewed & tested by the community » Fixed

Patch #35 committed, thanks everyone!

joelstein’s picture


mahesha-gg’s picture

I am experiencing the same issue using Views 7.x-3.13, Date 7.x-2.9, with Calendar 7.x-3.5. Will this patch work? Where/how do I apply it? Thanks.
Got it! Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

josaku’s picture

#53 works for me with Date 7.x-2.9.
#35 may not work for me (haven't checked though) since min_date and max_date are the same (why?) in our system.

Nik3D’s picture

Patch #35 did the trick. Thanks!

Q2U’s picture

#35 resolved my pager issue. Thanks!

SeanA’s picture

steenyweeny’s picture

+1 to RTBC patch #35

caillou’s picture

Patch #35 work for me. Thanks!

Stephen Ollman’s picture

#53 resolved the extra month jump for me.

tcfunk’s picture

So is this going to see an actual release?

Stephen Ollman’s picture

Whilst patch #53 worked on one site, a week later it no longer worked.

Had to amend this line:

$this->view->date_info->next_date->setDate($this->view->date_info->next_date->format('Y'), $this->view->date_info->next_date->format('n'), $this->view->date_info->next_date->format('t'));


$this->view->date_info->next_date->setDate($this->view->date_info->next_date->format('Y'), $this->view->date_info->next_date->format('n'), $this->view->date_info->next_date->format('t')+1);

to get it to work again.

Test all months forwards and backwards.

Toby Wild’s picture

(Ooops, double post, I work with Stephen who posted the same above, so I will limit mine)

Hi guys,

I don't entirely know why, but patch #53 didn't work for us.

This patch caused the 'Next' button in the Month view to stop moving forward.
'Previous' would work fine, but 'Next' would not advance the month.

Through sheer randomness, I tried adding a +1 day to the patch, and now it's working.

// See Stephens code examples above

And now it's working.

The site was a D6 migrated site, so it's not a best case scenario, but just in case anyone else comes across this issue.

oscaral’s picture

Patch #35 worked for me also. Thanks :)

runnergirl’s picture

Patch #35 worked for me. I was going from Date module version 7.x-2.8 to version 7.x-2.9. I'm using Calendar version 7.x-3.5. The calendar NEXT button was skipping a month in version 7.x-2.9 whereas it didn't in version 7.x-2.8. Once I applied the patch in #35, it worked correctly.
Thank you rsmylski for offering this fix, it's greatly appreciated.

bcobb10b’s picture

#35 worked for me in Date version 7.x-2.9. Kudos to all for the good research, and to rsmylski for the patch.

achu aji’s picture

Thanks for the patch (#35). It worked fine for me.

My Calendar version is 7.x-3.4 and version of Date Views is 7.x-2.9.

dandaman’s picture

Thanks! I upgraded to Date 7.x-2.10-beta1 and it fixed the issue.

RichardBeacham’s picture

#35 worked for me.

dbt102’s picture

I'm having this same issue with Drupal 8. I've checked it on D8.0.5, D8.1.x-dev and D8.2.x-dev.

Is this the right place to report the issue? Or should I create a new one in core and reference back to this?

cafuego’s picture

@dbt102: Date is part of Drupal 8 core, so you should (as you say) open an issue against date.module on the drupal project, then reference this issue.

RivkiTzipory’s picture

#35 Work for me!

joshuautley’s picture

#35 worked for me

GiorgosK’s picture

#35 has been committed some time ago, no need for patch

Installing the latest rc1 version worked for me

drush dl date --select
0. Cancel
1. 7.x-2.10-rc1    -  2016-Apr-27  -  Supported 
2. ....

chose 1.

thalemn’s picture

Installing the latest rc1 version also worked for me. Thanks!

League of MN Calendar

pslcbs’s picture

#35 worked on 7.x.2.9. Thanks!!

eXMarty’s picture

Also, I solved this problem by installing a module Date version 7.x-2.x-dev (2016-06-05)

Tamanda’s picture

#35 worked for me too! However, I also had to modify the settings for the pager from "format: CLEAN Urls" to "Format: pager". I think it was a problem regarding the url rewriting when the urls are made human friendly.

Biswajit Roy’s picture

Thanks "rsmylski" for the solution.

Solution #35 has worked for me too.

B. Roy

tactica_ryan’s picture

#35 worked for me. Thanks rsmylski!

jlashomb’s picture

#35 worked for me as well for 7.x-2.9

dandaman’s picture

Just to reiterate: This patch has already been committed to 7.x-2.10-rc1 and 7.x-2.x-dev, so I recommend just updating to one of those if you are experiencing this issue. No "#35 worked for me" posts are needed to confirm this should be committed as it is already committed, just not yet in the main release. To get the 7.x-2.10-rc1 release, click on "View All Releases". Then this fixes the above issue and you can also test other fixes before 7.x-2.10 is released. Thanks!

orizonmedia’s picture

(The pb is that the calendar skip some month on next button) I am running date 7.x-2.9 and was not able to rollback to dev or beta version cause date is used everywhere in many field and site is already in production... I just taken the line to change in the (changing max to min in line 284) and it works fine!!!! It save my life thank you very much.

borjaevo’s picture

#106 solved my problem

darksnow’s picture

Fix in #106, essentially manually applying the patch in #35 worked for me too.

Doesn't seem to be any implications to this either.

Haretuerk’s picture

#106 worked for me. Thanks!

ldwyer’s picture

#106 also worked for me. I am using Date 7.x-2.9 and Calendar 7.x-3.5 (Drupal 7.5). Thanks!

kwendling’s picture

#106 also worked for me also. Thank you.

dbourrion’s picture

#106 works for me - many many thanks, we were stuck with that.

nikky171091’s picture

#35 worked for me. Thanks!

miniwebs2’s picture

#106 worked for me - thank you.

pal_ur’s picture

#106 worked for me to. Thank you!

twood’s picture

#106 works. Very simple. Just made 3 sites complete. Thank you.

jlovato’s picture

#106 worked for me. @orizonmedia thanks for the explanation of what line to change.

EgbertB’s picture

Update to dat 7.x-2.x-dev or higer

arv.drupal’s picture

Had the similar issue. Updated to date 7.x-2.x-dev and it worked fine. Thanks