Home>Article>PHP Framework> Use of datepicker date component in yii

Use of datepicker date component in yii

王林
王林 Original
2019-12-24 14:19:40 2140browse

Use of datepicker date component in yii

1. Installation of date component

composer require kartik-v/yii2-widget-datepicker "@dev"

2. Use of date component

use kartik\date\DatePicker;  'Article[created_at]', 'options' => ['placeholder' => '...'], //value值更新的时候需要加上 'value' => '2016-05-03', 'pluginOptions' => [ 'autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true, ] ]); ?>

The usage of date component generated by ActiveForm is as follows :

field($model, 'created_at')->widget(DatePicker::classname(), [ 'options' => ['placeholder' => ''], 'pluginOptions' => [ 'autoclose' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd', ] ]); ?>

Rendering:

Use of datepicker date component in yii

Recommended related articles and tutorials:yii tutorial

The above is the detailed content of Use of datepicker date component in yii. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn