Support Forums

Date selector on grid calendar view is off by a month

  • Posts: 2 Topics: 4
    | Permalink

    Hi, great plugin. Finally someone made a real event calendar for WP.

    Except for one thing. When you’re looking at the calendar grid view, the name of the month in the dropdown is off by one month. So if I’m looking at my website’s calendar right now (January 2012) it shows December 2011 in the drop-down. Not to worry, here is a fix. Just change this bit of code in /public/template-tags/calendar.php, around line 144:

    function tribe_month_year_dropdowns( $prefix = ” ) {
    global $wp_query;

    if ( isset ( $wp_query->query_vars[‘eventDate’] ) ) {
    // change this line: $date = $wp_query->query_vars[‘eventDate’];
    $date = $wp_query->query_vars[‘eventDate’] . “-01″;

    } else {
    $date = date_i18n( TribeDateUtils::DBDATEFORMAT );
    }
    $monthOptions = TribeEventsViewHelpers::getMonthOptions( $date );
    $yearOptions = TribeEventsViewHelpers::getYearOptions( $date );
    include(TribeEvents::instance()->pluginPath.’admin-views/datepicker.php’);
    }

    Posts: 4240 Topics: 87 Answers: 467
    | Permalink
    Correct Answer

    This suggestion here is awesome, Steve – thank you. We’ve had a few users report this issue so far, and though I’ve been unable to recreate it on my end, your fix will definitely be of value to others who come with the same problem down the road. Thanks again.

    Posts: 4
    | Permalink

    Steve, I just found this solution – thank you for taking the time to share your fix. Unfortunately, I can’t find the /public/template-tags/calendar.php you are referring to. Can you give me bit more direction? It this in the Events Calendar Pro plug-in folder? Thanks again!

    Posts: 4240 Topics: 87 Answers: 467
    | Permalink

    Hey Emmett. That file would actually be in the folder for the free The Events Calendar; since PRO is an add-on that extends the functionality of free, a lot of the core stuff is in that free Events Calendar folder. Hope this helps – let me know if you’ve still got questions on it.

    Posts: 26 Topics: 3
    | Permalink

    That fixed it for me. Steve and Rob, I really appreciate your help.

    Posts: 4240 Topics: 87 Answers: 467
    | Permalink

    Happy to help (for what little I did). Steve’s the man.

    Dave, let us know if you need anything else in the future!

    Posts: 9 Topics: 2
    | Permalink

    This didn’t seem to fix it for me. I see what you did and that should have been the fix, but it’s not working for me. Also my tribe_get_current_month_text(); is a month behind.

    Any ideas?

    Posts: 9 Topics: 2
    | Permalink

    Wait, seems to work now…Odd.

    Posts: 4240 Topics: 87 Answers: 467
    | Permalink

    Great to hear that did it, David – if for some reason the problem arises again let me know and we’ll try and assist as best we can.

    Posts: 44 Topics: 12
    | Permalink

    good fix Steve! thxs!

    Posts: 4240 Topics: 87 Answers: 467
    | Permalink

    Heck yeah. Thanks for confirming that did the trick, Carlos.

    Posts: 6 Topics: 1
    | Permalink

    I found this post because I am having this problem as well and it appears that the change suggested here is already in place. Any other ideas as to what could cause this issue? I’m running v2.0.6 on WP 3.2.1.

    Posts: 6 Topics: 1
    | Permalink

    Nevermind…it turns out I misinterpreted the comment. It’s working correctly now.

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Glad to hear Spoa, let us know if there’s anything else we can help out with here.

This thread hasn’t seen any activity for quite some time and we are not accepting further replies.

If you need further help with this or any other issue, please create a new topic (you can of course include a link to this one if that helps to provide additional context) and one of the team will be only too happy to help.