Usage examples
このコンテンツはまだ日本語訳がありません。
Standalone input
Section titled “Standalone input”use yii2\extensions\timepicker\TimePicker;use yii\helpers\Html;
echo Html::label('Start time', 'start-time');echo TimePicker::widget([ 'name' => 'start_time', 'value' => '11:24 AM', 'options' => ['id' => 'start-time'], 'pluginOptions' => ['showSeconds' => true],]);ActiveForm field
Section titled “ActiveForm field”use yii2\extensions\timepicker\TimePicker;
echo $form->field($model, 'start_time')->widget(TimePicker::class, [ 'pluginOptions' => [ 'showMeridian' => false, 'defaultTime' => null, ],]);Client events
Section titled “Client events”use yii2\extensions\timepicker\TimePicker;
echo TimePicker::widget([ 'name' => 'start_time', 'pluginEvents' => [ 'changeTime.timepicker' => 'function (event) { console.log(event.time.canonicalValue); }', ],]);Handlers and custom addon markup are executable/trusted application configuration.