2017 © Pedro Peláez
 

library eg-jdate

Yii2 Jalali date & time

image

elephantsgroup/eg-jdate

Yii2 Jalali date & time

  • Thursday, April 5, 2018
  • by ElephantsGroup
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • JavaScript
  • 8 Dependents
  • 0 Suggesters
  • 14 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

Jalali Date

Yii2 Jalali date & time library based on mohammad-mahdy/yii2-jdate., (*1)

Installation

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

Either run, (*3)

php composer.phar require --prefer-dist elephantsgroup/eg-jdate "*"

or add, (*4)

"elephantsgroup/eg-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' => 'elephantsGroup\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

05/04 2018

dev-master

9999999-dev http://elephantsgroup.com

Yii2 Jalali date & time

  Sources   Download

MIT

The Requires

 

by Jalal Jaberi

extension yii2 yii jalali date elephantsgroup

05/04 2018

1.0.0

1.0.0.0 http://elephantsgroup.com

Yii2 Jalali date & time

  Sources   Download

MIT

The Requires

 

by Jalal Jaberi

extension yii2 yii jalali date elephantsgroup