The TimePicker widget allows you to easily select a time for a text input using your mouse or keyboards arrow keys. The widget is a wrapper enhancement of the TimePicker plugin by rendom forked from jdewit's TimePicker. This widget as used here has been specially enhanced for Yii framework 2.0 and Bootstrap 3. With release v1.0.4, the extension has been enhanced to support Bootstrap 4.x version.
The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability
settings for your application's composer.json.
To install, either run
composer require yii2-extensions/time-picker "^1.0"
or add
"yii2-extensions/time-picker": "*"
to the require
section of your composer.json
file.
NOTE: Refer the CHANGE LOG for details on changes to various releases.
use Yii2\Extensions\TimePicker\TimePicker;
// usage without model
echo '<label>Start Time</label>';
echo TimePicker::widget([
'name' => 'start_time',
'value' => '11:24 AM',
'pluginOptions' => [
'showSeconds' => true
]
]);
or in a form
<?= $form->field($model, 'start_time')->widget(TimePicker::class, [
'pluginOptions' => [
'showMeridian' => false,
'defaultTime' => null
]
]); ?>
time-picker extension is released under the BSD-3-Clause License. See the bundled LICENSE.md
for details.