Support from Acquia helps fund testing for Drupal Acquia logo

Comments

spiritcapsule’s picture

Ran into the same issue. Replicated issue on simplytest.me 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: https://www.drupal.org/node/2313405 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.

Beth

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 http://www.miala.org/calendar/month/2014-12/

Lostboy22’s picture

Version: 7.x-2.9-beta2 » 7.x-2.x-dev
Issue summary: View changes
FileSize
1.1 KB

moving to dev version, adding patch
This will also fixes https://www.drupal.org/node/2372073 Undefined variable: granularity line 283, 285 of date_views/includes/date_views_plugin_pager.inc

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 https://www.drupal.org/node/2372073.

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/date_views_plugin_pager.inc...
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/date_views_plugin_pager.inc:280
error: date_views/includes/date_views_plugin_pager.inc: patch does not apply


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

Status: Needs work » Needs review
FileSize
881 bytes

Have a look at this commit:

commit 139892032014e6e0d6500850b37679603abec236
Author: vijaycs85 <vijaycs85@93488.no-reply.drupal.org>
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/date_views_plugin_pager.inc)

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

FileSize
962 bytes

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]

my-family
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
FileSize
1.15 KB

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.

DrIPA’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

Anonymous’s picture

Status: Needs work » Needs review
FileSize
867 bytes

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

OK.

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
FileSize
1.66 KB

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.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

@Jelle_S

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

lias’s picture

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

chandraswami’s picture

[2015-10-31]

#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/date_views_plugin_pager.inc 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

Thanks!

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'));

with

$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.

AswathyAjish’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.

Thanks.
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
Thanks!

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 date_views_plugin_page.inc (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

https://www.drupal.org/project/date

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

Fool2’s picture

FileSize
22.45 KB

I am just putting this here in case someone else runs into this issue-- something caused my contextual filter to get out of sorts, and I thought it was caused by this issue. Updating to dev didn't help so I looked around more-- make sure that your "Month" view page has a granularity of "month" in the contextual filter. Mine was somehow set to "day" and it gave very weird results that mimic the symptoms in this issue thread.

rubenvarela’s picture

If anyone's checking on this - Patch on #35 got merged in here,

commit c388ec75c9cd6eba68fb798f0d4e9b63c461a0c1
Author: jelles <jelles@829198.no-reply.drupal.org>
Date:   Fri Dec 11 08:35:39 2015 +1100

First tag it appeared on is 7.x-2.10-beta1 then finally released on 7.x-2.10 on 7 April 2017 — https://www.drupal.org/project/date/releases/7.x-2.10

webservant316’s picture

+1 for #35. Why is this not committed?

dandaman’s picture

webservant316, please see the comment above yours, #121. It was committed over 3 years ago and released in 7.x-2.10 over two years ago. Make sure you are using the latest recommended version and not an old version on your site.

Also, see the comment above that about someone else who thought it was this code issue but it was instead some configuration. If you're running a newer version or dev version, maybe this no longer works again, so if that is the case, maybe look in the code to see what may have since then to break it.

I hope this information helps you debug the issue.

webservant316’s picture

Oh yeah, thanks for pointing that out. I am using 2.9 and was waiting for 2.11 because of this issue https://www.drupal.org/node/2873415. When 2.11 comes out I will drop the patch above.