littleboy / yii2-date-picker-thai-widget
为Yii2提供的Bootstrap DatePicker泰历(B.E.)小部件。
1.0.1
2018-06-30 18:53 UTC
Requires
- bower-asset/bootstrap-datepicker: 1.7.0
- yiisoft/yii2: >=2.0.9
- yiisoft/yii2-bootstrap: *
This package is not auto-updated.
Last update: 2024-09-24 17:57:58 UTC
README
这是Yii2扩展的泰历日历日期选择器。
修改自 (https://github.com/2amigos/yii2-date-picker-widget)。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
$ composer require karatae99/yii2-date-picker-thai-widget "~1.0"
或者在您的应用程序的 composer.json 文件的 require 部分添加:
"karatae99/yii2-date-picker-thai-widget" : "~1.0"
to the require section of your application's composer.json file.
使用方法
DatePicker
此小部件渲染Bootstrap DatePicker输入控件。最适合具有日期字符串属性的模型。
与表单一起使用的示例
使用它的两种方式:与一个 ActiveForm 实例一起使用,或者作为设置其 model 和 attribute 的部件。
<?php use karatae99\datepicker\DatePicker; // as a widget ?> <?= DatePicker::widget([ 'model' => $model, 'attribute' => 'date', 'template' => '{addon}{input}', 'language' => 'th', // Thai B.E. 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd/mm/yyyy' ] ]);?> <?php // with an ActiveForm instance ?> <?= $form->field($model, 'date')->widget( DatePicker::className(), [ // inline too, not bad 'inline' => true, // modify template for custom rendering 'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>', 'language' => 'th', // Thai B.E. 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd/mm/yyyy' ] ]);?>
无模型使用的示例
<?php use karatae99\datepicker\DatePicker; ?> <?= DatePicker::widget([ 'name' => 'Test', 'value' => '20/03/2561', 'template' => '{addon}{input}', 'language' => 'th', // Thai B.E. 'clientOptions' => [ 'autoclose' => true, 'format' => 'dd/mm/yyyy' ] ]);?>
更多信息
请查阅Bootstrap DatePicker网站的文档,以获取有关其配置选项的更多信息。
许可证
BSD许可证(BSD)。有关更多信息,请参阅许可证文件。