• On Safari, as well as all browsers on iOS and iPadOS, I’m not seeing the current Date on the Calendar view.

    I noticed the error:

    [Warning] Error: Invalid date provided: Invalid Date (events-manager.js, line 4683)

    I looked at the stack trace:

    Error: Invalid date provided: Invalid Date
    (anonymous function) — externals.js:10:8109
    pe — externals.js:10:34408
    (anonymous function) — externals.js:10:33737
    calendar_month_init — calendar.js:142
    em_calendar_init — calendar.js:246
    (anonymous function) — calendar.js:254
    dispatch — jquery.min.js:2:40041
    dispatchEvent
    success — calendar.js:62
    c — jquery.min.js:2:25310
    fireWith — jquery.min.js:2:26055
    l — jquery.min.js:2:77794
    (anonymous function) — jquery.min.js:2:80267

    and set a stop at calendar.js:142

    Interestingly… when I’m stopped there, the current Month *does* display. But when I continue script execution, I get the following error:

    [Warning] Error: Invalid date provided: Invalid Date — events-manager.js:4682 (events-manager.js, line 4683)

    And the Current Month no longer displays

    • This topic was modified 3 months, 4 weeks ago by mikecargal.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mikecargal

    (@mikecargal)

    More info…

    code is

    // this bit fixes issues if the supplied text value has a mismatch with the real text value due to localization differences between WP and flatpickr
    let month_real_value = monthpicker.val() + '-01';
    fp.setDate( new Date( month_real_value ) );

    which results in month_real_value of “February 2026-01”

    Changed my Month Format to “Y-m” and it’s working.

    Of course I don’t really want it to say “2025-12” at the top of the calendar

    I snooped around and found an appropriate value that was independent of the format selected.

    Changing the code above as follows, fixes it (at least for me)

    // this bit fixes issues if the supplied text value has a mismatch with the real text value due to localization differences between WP and flatpickr
    let month_real_value = monthpicker[0].getAttribute("value") + '-01';
    fp.setDate( new Date( month_real_value ) );

    (Site is now working fine, so no longer a good “broken” example)

    • This reply was modified 3 months, 4 weeks ago by mikecargal. Reason: formatting
    Thread Starter mikecargal

    (@mikecargal)

    Gah!!! Nevermind that fix… now the off by one month bug is back.

    Thread Starter mikecargal

    (@mikecargal)

    OK, so the problem is that it parses the date in UTC, and in the eastern time zone, midnight on the 1st (UTC) is 7:00 pm at the end of the previous month. But, since we only need the Month, just append “-02” and you avoid this problem.

    let month_real_value = monthpicker[0].getAttribute(“value”) + ‘-02’;

    That’s working here now (but you can’t use month picker.val() since that uses the formatted value and things don’t work well.

    I assume there’s probably a better way to get year and month out of monthpicker, but the code obfuscation makes it a bit difficult to sort that out.

    @mikecargal Can you please specify where exactly i can change this value?

    Thread Starter mikecargal

    (@mikecargal)

    @razorzz

    /wp-content/plugins/events-manager/includes/js/events/events-manager.js

    Search for “this bit fixes” (line 3563 here)

    replace

    let month_real_value = monthpicker.val() + '-01';
    fp.setDate( new Date( month_real_value ) );

    with:

    fp.setDate( new Date( fp.currentYear, fp.currentMonth, 2 ) );

    (Note, this is a bit different than the previous solution because I dug a bit deeper to find the values from the “proper” place)

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.