yii2 kartik daterangepicker自动选择单击开始日期时的结束日期

时间:2018-05-08 09:36:00

标签: yii2 daterangepicker kartik-v

我想将结束date设置为与开始date相同:

<?php
        echo $form->field($model, 'date_range', [
            'options' => ['class' => 'drp-container form-group']
        ])->widget(DateRangePicker::classname(), [
            'id' => 'dateRange',
            'convertFormat' => true,
            'pluginOptions' => [
                'timePicker' => true,
                'timePicker24Hour' => true,
                'timePickerIncrement' => 1,
                'autodate' => true,
                'minDate' => (string) date('Y-m-d H:i:s', strtotime('- 1 month')),
                'maxDate' => (string) date('Y-m-d H:i:s'),
                'singleDatePicker' => false,
                'autoApply' => false,
                'locale' => ['format' => 'Y-m-d H:i:s']
            ],
            'pluginEvents' => [
            ],
        ])
        ?>

当我尝试选择这样的结束日期时,它无法正常运行:

$(document).on('click', 'td.available', function (e) {
            $('#dateRange').data('daterangepicker').setEndDate(date);
        })

是否有可能让它像我想的那样工作?

问候!

0 个答案:

没有答案