aekkapun/yii2-bootstrap4-date-thai-widget

Bootstrap4 DatePicker Thai Yii2.

1.0.1 2018-06-30 18:53 UTC

This package is not auto-updated.

Last update: 2024-09-25 08:44:11 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"

到 require 部分中。

使用方法

DatePicker

此小部件渲染Bootstrap日期选择器输入控件。最适合具有日期字符串属性的模型。

与表单一起使用的示例
有两种使用方式,使用 ActiveForm 实例或作为设置其 modelattribute 的 widget。

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