class PlotCreation extends \yii\base\Model
{
public $date_from;
public $date_to;
...
}
echo DateRangePicker::widget([
'name' => 'date_range',
'value' => '2017-05-02 01:00:00 PM - 2017-05-03 01:00:00 PM',
'convertFormat' => true,
'pluginOptions' => [
'timePicker' => true,
'timePickerIncrement' => 10,
'locale' => ['format' => 'Y-m-d h:i:s']
]
]);
startAttribute: string, the attribute name which you can set optionally to track changes to the range start value. One of the following actions will be taken when this is set:
If using with model, an active hidden input will be automatically generated using this as an attribute name for the start value of the range.
endAttribute: string, the attribute name which you can set optionally to track changes to the range end value. One of the following actions will be taken when this is set:
If using with model, an active hidden input will be automatically generated using this as an attribute name for the end value of the range.
$model->datetime_start = '2016-02-11';
$model->datetime_end = '2016-03-15';
echo '<div class="input-group drp-container">';
echo DateRangePicker::widget([
'model'=>$model,
'attribute' => 'kvdate1',
'useWithAddon'=>true,
'convertFormat'=>true,
'startAttribute' => 'datetime_start',
'endAttribute' => 'datetime_end',
'pluginOptions'=>[
'locale'=>['format' => 'Y-m-d'],
]
]) . $addon;
echo '</div>';