2amigos / yii2-date-picker-widget

Bootstrap DatePicker Widget for Yii2
https://2amigos.us
Other
130 stars 77 forks source link

Multidate not working with 'inline' #14

Open boutsen opened 9 years ago

boutsen commented 9 years ago

When using multidate and multidateSeparator in inline mode I notice only the last date selected is being updated in the input tag.

<?= DatePicker::widget([
                'inline' => true,
                'name' => 'test',
                'template' => '<div class="well well-sm" 
style="background-color: #fff; width:250px">{input}</div>',
                'clientOptions' => [
                    'format' => "yyyy-mm-dd",
                    'weekStart' => 1,
                    'startDate' => "today+1",
                    'daysOfWeekDisabled' => "0",
                    'multidate' => true,
                    'multidateSeparator' => ";",
                ]
            ]);?>

For example if I select 2 dates : The input tag value only contains 1 date ( last one selected ).

capture

tonydspaniard commented 7 years ago

I believe the internal jquery plugin doesn't work properly with multiple date selection 'inline'. What about DateRangePicker instead?

utkarshshinde07 commented 6 years ago

I got same issue in kartik's bootstrap datepicker i solved issue by changing line from 439 to 441. its in under function registerAssets(). if ($this->type === self::TYPE_INLINE) { $view->registerJs("{$el}.on('changeDate',function(e){{$input}.val({$el}.kvDatepicker('getFormattedDate'));});"); }

mohdqasim98 commented 6 years ago

I believe the internal jquery plugin doesn't work properly with multiple date selection 'inline'. What about DateRangePicker instead?

That won't work, in case someone wants to select non-continuous dates