Datepicker – blockout weekends and specific days

Home Forums Quform WordPress Datepicker – blockout weekends and specific days

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14555
    pik70
    Participant

    Hi,

    I have two forms, in the first form I blocked the thursdays with your code “Blocking entire days”, and it’s work. I need block the wednesday in the second form, when I put again the code in the functions.php, just change the unique ID and the days, doesn’t work and my web show me a error.

    This is my code:

    //FIRST BLOCK//
    function mytheme_datepicker_block_days($options, $dpMinYear, $dpMaxYear, $element)
    {
    return “{
    beforeShowDay: function (date) {
    var day = date.getDay();
    if (day == 0 || day == 1 || day == 2 || day == 3 || day == 5 || day == 6) {
    // Esta fecha no opera este tour.
    return [false, ”];
    } else {
    return [true, ”];
    }
    }
    }”;
    }
    add_filter(‘iphorm_datepicker_options_iphorm_206_64′, ‘mytheme_datepicker_block_days’, 10, 4);

    function mytheme_block_days($valid, $value, $element)
    {
    if ($valid) {
    $time = strtotime(“{$value[‘year’]}-{$value[‘month’]}-{$value[‘day’]}”);
    $day = date(‘w’, $time);

    if (day == 0 || day == 1 || day == 2 || day == 3 || day == 5 || day == 6) {
    $element->addError(‘Este tour tiene salidas los días JUEVES’);
    $valid = false;
    }
    }

    return $valid;
    }
    add_filter(‘iphorm_element_valid_iphorm_206_64′, ‘mytheme_block_days’, 10, 3);

    //SECOND BLOCK//
    function mytheme_datepicker_block_days($options, $dpMinYear, $dpMaxYear, $element)
    {
    return “{
    beforeShowDay: function (date) {
    var day = date.getDay();
    if (day == 0 || day == 1 || day == 2 || day == 4 || day == 5 || day == 6) {
    // Esta fecha no opera este tour.
    return [false, ”];
    } else {
    return [true, ”];
    }
    }
    }”;
    }
    add_filter(‘iphorm_datepicker_options_iphorm_207_64′, ‘mytheme_datepicker_block_days’, 10, 4);

    function mytheme_block_days($valid, $value, $element)
    {
    if ($valid) {
    $time = strtotime(“{$value[‘year’]}-{$value[‘month’]}-{$value[‘day’]}”);
    $day = date(‘w’, $time);

    if (day == 0 || day == 1 || day == 2 || day ==43 || day == 5 || day == 6) {
    $element->addError(‘Este tour tiene salidas los días MIERCOLES’);
    $valid = false;
    }
    }

    return $valid;
    }
    add_filter(‘iphorm_element_valid_iphorm_207_64′, ‘mytheme_block_days’, 10, 3);

    Regards,

    #14641
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #14708
    pik70
    Participant

    Hi Ally,

    I put your code and it’s work.

    Thanks 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy