littleboy / yii2-date-picker-thai-widget

为Yii2提供的Bootstrap DatePicker泰历(B.E.)小部件。

安装: 3

依赖项: 0

建议者: 0

安全: 0

星级: 0

关注者: 0

分支: 1

类型:yii2-extension

1.0.1 2018-06-30 18:53 UTC

This package is not auto-updated.

Last update: 2024-09-24 17:57:58 UTC


README

Latest Version License Total Downloads

这是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 实例一起使用,或者作为设置其 modelattribute 的部件。

<?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)。有关更多信息,请参阅许可证文件