2017 © Pedro Peláez
 

library yii2-jdate

Jalali date & time.

image

mohammad-mahdy/yii2-jdate

Jalali date & time.

  • Tuesday, December 27, 2016
  • by MrAlexGh
  • Repository
  • 5 Watchers
  • 14 Stars
  • 1,857 Installations
  • JavaScript
  • 6 Dependents
  • 0 Suggesters
  • 14 Forks
  • 3 Open issues
  • 7 Versions
  • 10 % Grown

The README.md

Jalali Date

Jalali date & time is an extension for yii2., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist mohammad-mahdy/yii2-jdate "*"

or add, (*4)

"mohammad-mahdy/yii2-jdate": "*"

to the require section of your composer.json file., (*5)

Usage of DateTime

Once the extension is installed, add it as a component :, (*6)

'jdate' => [
    'class' => 'jDate\DateTime'
]

Now you can use in your project:, (*7)

Yii::$app->jdate->date('Y-m-d');

You can access dates and times as variable :, (*8)

Yii::$app->jdate->Y;

Usage of DatePicker

It is a widget to make a input, box to giver jalali date from user., (*9)

A basic usage:, (*10)

<?= jDate\DatePicker::widget([
    'name' => 'datepicker'
]) ?>

If you want set default date set value:, (*11)

<?= jDate\DatePicker::widget([
    'name' => 'datepicker', 'value' => '1394/01/01'
]) ?>

Using a model:, (*12)

<?= jDate\DatePicker::widget([
    'model' => $model, 'attribute' => 'date'
]) ?>

Use in active form:, (*13)

<?= $form->field($model, 'fieldname')->widget(jDate\DatePicker::className()) ?>

Datepicker ClientOptions

Add these to ClientOptions var., (*14)

Change date picker size:

[
    'cellHeight' => 13,
    'cellWidth'  => 13
]

Change font size:

[
    'fontSize' => 25
]

Use english numbers in date picker:

[
    'persianNumbers' => false
]

Date format:

[
    'formatDate' => 'DD-NM-YYYY hh:m'
]

Datepicker Theme

Now date picker have 2 theme default and dark., (*15)

For set theme set theme var., (*16)

<?= jDate\DatePicker::widget([
    'model' => $model, 'attribute' => 'date', 'theme' => 'dark'
]) ?>

Datepicker Events

NOTE : If you want rewriting onSelect event and using active form add options[id] and add, (*17)

```javascript $('#your id').trigger('change');, (*18)

> 
> to your event function.

####`onHide` Event:

```php
<?= jDate\DatePicker::widget([
    'model' => $model, 'attribute' => 'date',
    'ClientOptions' => [
        'onHide' => 'function(){alert("Datepicker is now hidden!")}'
    ]
]) ?>

onSelect Event:

<?= jDate\DatePicker::widget([
    'model' => $model, 'attribute' => 'date',
    'ClientOptions' => [
        'onSelect' => 'function(){alert("Date selected!")}'
    ]
]) ?>

onShow Event:

<?= jDate\DatePicker::widget([
    'model' => $model, 'attribute' => 'date',
    'ClientOptions' => [
        'onShow' => 'function(){alert("Hello!")}'
    ]
]) ?>

The Versions

27/12 2016

dev-master

9999999-dev

Jalali date & time.

  Sources   Download

BSD-3-Clause

The Requires

 

by Mohammad Mahdi Gholamian

extension yii2 yii jdate persian date jalali data time yiiframeowrk

27/12 2016

0.8.1

0.8.1.0

Jalali date & time.

  Sources   Download

BSD-3-Clause

The Requires

 

by Mohammad Mahdi Gholamian

extension yii2 yii jdate persian date jalali data time yiiframeowrk

18/07 2015

0.8

0.8.0.0

Jalali date & time.

  Sources   Download

BSD-3-Clause

The Requires

 

by Mohammad Mahdi Gholamian

extension yii2 yii jdate persian date jalali data time yiiframeowrk

25/07 2014

0.7

0.7.0.0

Jalali date & time.

  Sources   Download

BSD-3-Clause

The Requires

 

by Mohammad Mahdi Gholamian

extension yii2 jdate jalali data time

24/07 2014

0.6

0.6.0.0

Jalali date & time.

  Sources   Download

BSD-3-Clause

The Requires

 

by Mohammad Mahdi Gholamian

extension yii2 jdate jalali data time

20/07 2014

0.5

0.5.0.0

Jalali date & time.

  Sources   Download

BSD-3-Clause

The Requires

 

by Mohammad Mahdi Gholamian

extension yii2 jdate jalali data time

24/05 2014

0.2

0.2.0.0

Jalali date & time.

  Sources   Download

BSD-3-Clause

by Mohammad Mahdi Qolamian

extension yii2 jdate jalali data time