https://github.com/yetopen/i18n-datetime-behavior
Yii i18n-datetime-behavior extension fork
https://github.com/yetopen/i18n-datetime-behavior
Last synced: over 1 year ago
JSON representation
Yii i18n-datetime-behavior extension fork
- Host: GitHub
- URL: https://github.com/yetopen/i18n-datetime-behavior
- Owner: YetOpen
- Created: 2013-06-27T08:54:25.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2019-01-30T20:12:47.000Z (over 7 years ago)
- Last Synced: 2025-01-22T15:45:43.281Z (over 1 year ago)
- Language: PHP
- Homepage: http://www.yiiframework.com/extension/i18n-datetime-behavior/
- Size: 9.77 KB
- Stars: 2
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
i18n-datetime-behavior
======================
Yii i18n-datetime-behavior extension
Sourced from version 1.1 of http://www.yiiframework.com/extension/i18n-datetime-behavior/
Author: Ricardo Grana ,
This extension is a behavior that can be used in models to allow them to automatically parse and format i18N date formats.
The behavior scans for date and datetime fields in the model attributes, and do the conversions needed.
Documentation
=============
Requirements
------------
Yii 1.0.9 or above
You need to have defined your desired language at the entry script.
Installation
Extract the release file and put it under protected/extensions
Usage
-----
In you model, add the following code:
```php
public function behaviors()
{
return array('datetimeI18NBehavior' => array('class' => 'ext.DateTimeI18NBehavior')); // 'ext' is in Yii 1.0.8 version. For early versions, use 'application.extensions' instead.
}
```
IMPORTANT! This behavior changes afterFind and beforeSave events. If your model have to have coding, please, don't forget to add the parent reference:
```php
protected function beforeSave(){
if (!parent::beforeSave()) return false;
....your code
}
```
The same for afterFind method. Otherwise, this behavior will not make effect.