wattanapong/yii2-widget-datetimepicker

DatetimePicker extension for the Yii2 framework

Installs: 177

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 1

Language:JavaScript

Type:yii2-widget-datetimepicker

1.0.0 2017-01-07 22:51 UTC

This package is not auto-updated.

Last update: 2025-04-26 23:00:18 UTC


README

This is thai buddhist calendar datetimepicker of Yii2 extension. modified from https://code.google.com/archive/p/jquery-ui-datepicker-extension-buddhist-era/ by sorajate@gmail.com

created by wattanapong suttapak email me wattanapong.su@up.ac.th

This version 1.0.0 It's completed version of datetimepicker work on jquery-ui less than version 1.9 . This version support datepicker and datetimepicker via Datetimepicker::Classname

Installation

To install, either run

$ composer require wattanapong/yii2-widget-datetimepicker "@dev"

or add

"wattanapong/yii2-widget-datetimepicker" : "@dev"

Usage

All of usage base on jquery-ui

DateTimePicker

use wattanapong\datetime\DateTimePicker;

// usage without model
echo '<label>Check Issue Date</label>';
echo DateTimePicker::widget([
	'name' => 'attributename', 
	'value' => date('d M Y', strtotime('+2 days')),
	'options' => ['placeholder' => 'Select date ...'],
	'pluginOptions' => [
		'format' => 'dd-M-yyyy',
		'todayHighlight' => true,
		'isBE' => true,	
		'timeFormat' => 'hh:mm:ss',
		'buttonImageOnly'=> true,
		'maxDate' => date('d M Y',strtotime('+2 days')),
		'minDate' => date('d M Y',strtotime('-10 days')),
	]
]);

// usage with model

<?= $form->field($model, 'attributename')->widget(DateTimePicker::className(),
    [
    	'dateFormat' => 'php:d M yy',
		'isDateTime' => false,
		'name' => 'attributename',
		'value' => date('d M Y', strtotime('+2 days')),
		'options' => ['class'=>'form-control','placeholder' => 'Select date ...'],
		'pluginOptions' =>[
			'isBE' => true,	
			'timeFormat' => 'hh:mm:ss',
			'buttonImageOnly'=> true,
			'maxDate' => date('d M Y',strtotime('+2 days')),
			'minDate' => date('d M Y',strtotime('-10 days')),
		]
   	]
)?>

DateTimePicker with DateRange

cannot use inline option

use wattanapong\datetime\DateTimePicker;

// usage without model
echo '<label>Check Issue Date</label>';
echo DateTimePicker::widget([
	//'model' => $modelTrainingCourse,
	'from' => 'trainingdate',
	'value' => date('d M Y'),
	'to' => 'trainingend',
	'valueTo' => date('d M Y', strtotime('+2 days')),
	'dateFormat' => 'php:d M yy',
	'isDateTime' => true,
	//'separate' => 'To',
	'options' => ['class'=>'form-control','placeholder' => 'Select date ...'],
	'pluginOptions' =>[
		'isBE' => true,	
		'timeFormat' => 'hh:mm:ss',
		'showButtonPanel' => true,
		'maxDate' => date('d M Y'),
		'minDate' => date('d M Y',strtotime('-10 days')),
		'maxDateTo' => date('d M Y',strtotime('+30 days')),
		'minDateTo' => date('d M Y',strtotime('-10 days')),
	]
]);