0

I want to limit the input in a datefield to (minimum) today+7. I found the snippet below, but i don't know how to customize it. Anyone that can help? (Sunday may be available)

/**
 * Limit the dates available in the Date Time date picker.
 *
 */
function wpf_dev_limit_date_picker() {
    ?>
    <script type="text/javascript">
        window.wpforms_1269 = window.wpforms_1269 || {};
        window.wpforms_1269.datepicker = {
            disableMobile: true,
            // Don't allow users to pick past dates
            minDate: new Date(),
            // Don't allow users to pick Sundays
            enable: [
                function(dateObj){
                    return dateObj.getDay() !== 0;
                }
            ]
        }
    </script>
    <?php
}
add_action( 'wpforms_wp_footer', 'wpf_dev_limit_date_picker' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.