定制 karatae99/yii2-datepicker-thai-bs4 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

karatae99/yii2-datepicker-thai-bs4

最新稳定版本:1.0.0

Composer 安装命令:

composer require karatae99/yii2-datepicker-thai-bs4

包简介

Bootstrap4 DatePicker Thai Buddhist-Era (B.E.) widget for Yii2.

README 文档

README

Latest Version License Total Downloads

This is Bootstrap4 thai Buddhist-Era (B.E.) datepicker for Yii2 extension.

Credits

2amigOS! Consulting Group for inspiration by Bootstrap DatePicker Widget for Yii2 and code examples.

Kartik Visweswaran for Bootstrap 4.x styling.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require karatae99/yii2-datepicker-thai-bs4 "~1.0"

or add

"karatae99/yii2-datepicker-thai-bs4" : "~1.0"

to the require section of your application's composer.json file.

Configuration

To set this up, add this section of code to your application params configuration file (e.g. common/config/params.php):

return [
    ...
    'bsVersion' => '4.x',
];

Icons for Bootstrap

Bootstrap 4.x does not include glyphicons or any other icons framework bundled with the library. To include font awesome assets on your page, include the following markup on the HEAD section of your view layout file, when bsVersion is set to 4.x. (e.g. frontend/views/layouts/main.php):

<head>
...
<!-- on your view layout file HEAD section -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css">
</head>

Usage

DatePicker

This widget renders a Bootstrap DatePicker input control. Best suitable for model with date string attribute.

Example of use with a form
There are two ways of using it, with an ActiveForm instance or as a widget setting up its model and attribute.

<?php
use karatae99\datepicker\DatePicker;
?>

// with an ActiveForm instance 
<?= $form->field($model, 'yourdate', [])->widget(DatePicker::ClassName(),
    [           
            'options' => ['placeholder' => 'เลือกวันที่ '],
            'template' => '{addon}{input}',    
            'language' => 'th',             //<-- Thai B.E.			
            'clientOptions' => [                    
                'format' => 'dd/mm/yyyy',   //<-- Thai B.E.
                'maxViewMode' => 'year',    //“month”, “year”, “decade”, “century” and “millenium”
                'autoclose' => true,
                'todayHighlight' => true,
                'todayBtn' => "linked",
                'clearBtn'  => true,                                                                                                                                         
            ]
    ]);?> 

DateRangePicker

This widget renders a Bootstrap4 DateRangePicker Input control.

Example of use with a form
The following example works with a model that has two attributes named date_from and date_to.

<?php
use karatae99\datepicker\DateRangePicker;
?>

// with an ActiveForm instance
<?= $form->field($model, 'date_from')->widget(DateRangePicker::className(), 
    [
            'attribute' => 'date_from',
            'attributeTo' => 'date_to', 
            'options' => ['placeholder' => 'Start date'],
            'optionsTo' => ['placeholder' => 'End date'],      
            'language' => 'th',			//<-- Thai B.E.
            'size' => 'md', //sm. md. lg.
            'clientOptions' => [
                    'format' => 'dd/mm/yyyy',	//<-- Thai B.E.
                    'maxViewMode' => 'decade',	//“month”, “year”, “decade”, “century” and “millenium”
                    'autoclose' => true,			
                    'todayHighlight' => true,
                    'todayBtn' => "linked",
                    'clearBtn'  => true,
            ]
    ]);?>

Further Information

Please, check the Bootstrap DatePicker site documentation for further information about its configuration options.

License

The BSD License (BSD). Please see License File for more information.

统计信息

  • 总下载量: 213
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-09-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固