限制jQuery UI Datepicker中的第二个日期

时间:2016-11-18 15:15:53

标签: javascript jquery datepicker

这被标记为重复,但我无法看到。另一篇文章涉及将第二个日期限制在第一个选择中当前选择的日期,我没有尝试这样做,已经有了。我试图在第二个日历/日期添加+ 3天。因此,如果我今天在第一个日期和第二个日期选择,我将无法选择该日期+ 3天的日期。

我在datepicker中遇到日期范围问题。我需要" carrental_to_date"在所选" carrental_from_date"之后至少3天但似乎没什么用。

我尝试过更改" minDate"在" to_date"到" + 3d"但它似乎没有选择,我确实在这里找到了一个例子:http://jsfiddle.net/jquerybyexample/dxbtp/494/但我也无法做到这一点。不知道我在这里做错了什么,并希望你们中的一个天才能够指出我正确的方向。

jQuery('#carrental_from_date' + element_id).datepicker({
                //showOn: "both",
                beforeShow: carrental_customRange,
                dateFormat: "<?php echo date_format_js(isset($theme_options['date_format']) ? $theme_options['date_format'] : ''); ?>",
                firstDay: "<?php echo (isset($theme_options['date_format_first_day']) ? (int) $theme_options['date_format_first_day'] : 0); ?>",
                dayNamesMin: ["<?php echo CarRental::t('Su') ?>", "<?php echo CarRental::t('Mo') ?>", "<?php echo CarRental::t('Tu') ?>", "<?php echo CarRental::t('Wu') ?>", "<?php echo CarRental::t('Th') ?>", "<?php echo CarRental::t('Fr') ?>", "<?php echo CarRental::t('Sa') ?>"],
                monthNames: ["<?php echo CarRental::t('January') ?>", "<?php echo CarRental::t('February') ?>", "<?php echo CarRental::t('March') ?>", "<?php echo CarRental::t('April') ?>", "<?php echo CarRental::t('May') ?>", "<?php echo CarRental::t('June') ?>", "<?php echo CarRental::t('July') ?>", "<?php echo CarRental::t('August') ?>", "<?php echo CarRental::t('September') ?>", "<?php echo CarRental::t('October') ?>", "<?php echo CarRental::t('November') ?>", "<?php echo CarRental::t('December') ?>"],
                dayNames: ["<?php echo CarRental::t('Sunday') ?>", "<?php echo CarRental::t('Monday') ?>", "<?php echo CarRental::t('Tuesday') ?>", "<?php echo CarRental::t('Wednesday') ?>", "<?php echo CarRental::t('Thursday') ?>", "<?php echo CarRental::t('Friday') ?>", "<?php echo CarRental::t('Saturday') ?>"],
                nextText: "<?php echo CarRental::t('Next') ?>",
                prevText: "<?php echo CarRental::t('Prev') ?>",
                minDate: 0,
                onSelect: function() {
                    carrental_update_business_hours(element_id);
                }
            });

            jQuery('#carrental_to_date' + element_id).datepicker({
                //showOn: "both",
                beforeShow: carrental_customRange,
                dateFormat: "<?php echo date_format_js(isset($theme_options['date_format']) ? $theme_options['date_format'] : ''); ?>",
                firstDay: "<?php echo (isset($theme_options['date_format_first_day']) ? (int) $theme_options['date_format_first_day'] : 0); ?>",
                dayNamesMin: ["<?php echo CarRental::t('Su') ?>", "<?php echo CarRental::t('Mo') ?>", "<?php echo CarRental::t('Tu') ?>", "<?php echo CarRental::t('Wu') ?>", "<?php echo CarRental::t('Th') ?>", "<?php echo CarRental::t('Fr') ?>", "<?php echo CarRental::t('Sa') ?>"],
                monthNames: ["<?php echo CarRental::t('January') ?>", "<?php echo CarRental::t('February') ?>", "<?php echo CarRental::t('March') ?>", "<?php echo CarRental::t('April') ?>", "<?php echo CarRental::t('May') ?>", "<?php echo CarRental::t('June') ?>", "<?php echo CarRental::t('July') ?>", "<?php echo CarRental::t('August') ?>", "<?php echo CarRental::t('September') ?>", "<?php echo CarRental::t('October') ?>", "<?php echo CarRental::t('November') ?>", "<?php echo CarRental::t('December') ?>"],
                dayNames: ["<?php echo CarRental::t('Sunday') ?>", "<?php echo CarRental::t('Monday') ?>", "<?php echo CarRental::t('Tuesday') ?>", "<?php echo CarRental::t('Wednesday') ?>", "<?php echo CarRental::t('Thursday') ?>", "<?php echo CarRental::t('Friday') ?>", "<?php echo CarRental::t('Saturday') ?>"],
                nextText: "<?php echo CarRental::t('Next') ?>",
                prevText: "<?php echo CarRental::t('Prev') ?>",
                minDate: 0,
                onSelect: function() {
                    carrental_update_business_hours(element_id);
                }
            });

0 个答案:

没有答案