示例#1
0
//               'format'=>'DD.MM.YYYY HH:mm:ss',
//               'useCurrent'=>false,
//               'showClose'=>true,
//               'widgetPositioning'=>['horizontal'=>'right']
//           ],
//         ]
//         );
?>

    
        </div>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
          <?php 
echo DateTimePicker::widget(['name' => 'date_from', 'value' => Yii::$app->request->queryParams['date_from'], 'addonBefore' => false, 'clientOptions' => ['locale' => 'ru', 'inline' => false, 'showTodayButton' => true, 'format' => 'DD.MM.YYYY', 'useCurrent' => false, 'showClose' => true, 'widgetPositioning' => ['horizontal' => 'right']]]);
echo Html::label('по', null, ['style' => 'margin: 0px 15px 0px 15px;']);
echo DateTimePicker::widget(['name' => 'date_to', 'value' => Yii::$app->request->queryParams['date_to'], 'addonBefore' => false, 'clientOptions' => ['locale' => 'ru', 'inline' => false, 'showTodayButton' => true, 'format' => 'DD.MM.YYYY', 'useCurrent' => false, 'showClose' => true, 'widgetPositioning' => ['horizontal' => 'right']]]);
?>
        </div>
    </div>
   <div class="form-group">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            
           
            

             <?php 
echo Html::submitButton('Показать', ['class' => 'btn btn-primary', 'style' => 'margin-left:30px;border-radius:0px;']);
?>
             <!-- <input id="slider" type="text"/><br/> -->
        </div>
        
 /**
  * Registers CKEditor JS
  */
 protected function registerClientScript()
 {
     $view = $this->getView();
     DateTimePickerAsset::register($view);
     if (!$this->jsFormat) {
         $this->jsFormat = DateTimePicker::convertPhpDateToMomentJs(FormatConverter::convertDateIcuToPhp($this->phpFormat));
     }
     /*
      * locale fix
      * @author <https://github.com/sim2github>
      */
     if (!isset($this->clientOptions['locale'])) {
         $applocale = strtolower(substr(Yii::$app->language, 0, 2));
         //First 2 letters
         $this->clientOptions['locale'] = $applocale;
     }
     if (!isset($this->clientOptions['format'])) {
         $this->clientOptions['format'] = $this->jsFormat;
     }
     if (!isset($this->clientOptions2['locale'])) {
         $applocale = strtolower(substr(Yii::$app->language, 0, 2));
         //First 2 letters
         $this->clientOptions2['locale'] = $applocale;
     }
     if (!isset($this->clientOptions2['format'])) {
         $this->clientOptions2['format'] = $this->jsFormat;
     }
     $config = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
     $config2 = empty($this->clientOptions2) ? '' : Json::encode($this->clientOptions2);
     $js = "\$('#" . $this->options['id'] . "').datetimepicker({$config});";
     $js .= "\$('#" . $this->options2['id'] . "').datetimepicker({$config2});";
     $view->registerJs($js);
 }