Calendar Day View - Current Day Bug

Issue #45 resolved
johannesmutter created an issue

when the calendar is opened in day view as a default and no date is selected, e.g. calendar is opened through the menu on the left, this error occurs:

PHP Fatal error: Call to a member function get_title() on boolean in /wp-content/plugins/woocommerce-appointments/includes/admin/class-wc-appointments-admin-calendar.php on line 213" while reading upstream

Which results in not loading the js files correctly, e.g. datepicker will not load: Uncaught TypeError: jQuery(...).datepicker is not a function

Comments (3)

  1. johannesmutter reporter

    this causes no error edit.php?post_type=wc_appointment&page=appointment_calendar&view=day&tab=calendar&filter_appointments&calendar_day

    this causes an error edit.php?post_type=wc_appointment&page=appointment_calendar

  2. johannesmutter reporter

    Quick Fix to prevent the missing datepicker script from blocking the rest of js functionality and providing a native datepicker instead:

    if (jQuery.fn.datepicker) {
        jQuery( '.calendar_day' ).datepicker({
            dateFormat: 'yy-mm-dd',
            numberOfMonths: 1,
        });
    } else {
        jQuery( '.calendar_day' ).prop('type','date');
    }
    
  3. Log in to comment