winkers / yii2-persian-datetime-picker-widget
用于 Yii2 的波斯语日期时间选择小部件
v1.0.0
2018-07-18 22:12 UTC
Requires
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2024-09-21 04:45:41 UTC
README
用于 Yii2 的波斯语日期时间选择小部件
其他语言版本:英文
目录
安装
安装此扩展的首选方法是通过 composer。
运行以下命令之一:
php composer.phar require --prefer-dist winkers/yii2-persian-datetime-picker-widget "*"
或者添加以下内容到您的 composer.json
文件的 require 部分。
"winkers/yii2-persian-datetime-picker-widget": "*"
安装扩展后,只需按照以下步骤进行:
用法
在视图文件中简单使用该扩展
使用扩展
基本用法
use winkers\persianDatetimePickerWidget\PersianDatetimePickerWidget;
调用小部件
与 model
一起使用
<?= PersianDatetimePickerWidget::widget(); ?>
与 ActiveForm
一起使用
<?= PersianDatetimePickerWidget::widget([
'model' => $model,
'attribute' => 'attribute'
]) ?>
这是扩展的截图
<?= $form->field($model, 'attribute')->widget(PersianDatetimePickerWidget::className()) ?>
截图
使用这些选项来自定义小部件以满足您的需求
自定义
图标
值类型:
bool
- 默认值:
true
- 图标选项
值类型:
array
- 默认值:
['class' => 'glyphicon glyphicon-calendar']
- 附加选项
默认值:
['class' => 'input-group-addon']
- 默认值:
['class' => 'glyphicon glyphicon-calendar']
- 选项
默认值:
['class' => 'form-control']
- 默认值:
['class' => 'glyphicon glyphicon-calendar']
- 设置
放置
值类型:
string
- 值:
left
|top
|right
|bottom
- 默认类型:
bottom
- 触发
- 值:
值:
click
|focus
|mouseover
- 值:
left
|top
|right
|bottom
- 默认类型:
click
- 格式
- 值:
值
- 值:
left
|top
|right
|bottom
yyyy
:4位年份yy
:2位年份MMMM
:波斯语月份名称MM
:2位月份M
:1位月份dddd
:波斯语星期名称dd
:2位日期d
:1位日期HH
:从00到24的2位小时H
:从0到24的1位小时hh
:从00到12的2位小时h
:从0到12的1位小时mm
:2位分钟m
:1位分钟- 默认类型:
yyyy-MM-dd
- ...
- groupId
- 值:
默认值:无默认值
- 值:
left
|top
|right
|bottom
- fromDate
- 值:
值:
true
|false
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
disableBeforeToday
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
disabled
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
enableTimePicker
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
isGregorian
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
englishNumber
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
This is an example of widget usage
- 值:
left
|top
|right
|bottom
- default value :
false
- toDate
- 值:
示例
这是一个小部件使用示例
<?= $form->field($model, 'attribute')->widget(PersianDatetimePickerWidget::className(), [
'icon' => true,
'iconOptions' => [
'class' => 'glyphicon glyphicon-calendar'
],
'settings' => [
'enableTimePicker' => 'true',
'format' => 'yyyy-MM-dd HH:mm',
'placement' => 'left',
]
])
?>
许可
该项目在 GNU General Public License v2.0
许可下发布。有关详细信息,请参阅 LICENSE。
贡献
我为 Yii2 编写了此扩展。感谢 Mohammmad Dayyan 为 MD.BootstrapPersianDateTimePicker 和在 The MIT License
许可下发布这个出色的 javascript
日期选择器。