Skip to content

Commit f9a54b7

Browse files
committed
Added documentation from extension page
1 parent 5bfe689 commit f9a54b7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,40 @@ Yii i18n-datetime-behavior extension
55
Sourced from version 1.1 of http://www.yiiframework.com/extension/i18n-datetime-behavior/
66

77
Author: Ricardo Grana <[email protected]>, <[email protected]>
8+
9+
10+
This extension is a behavior that can be used in models to allow them to automatically parse and format i18N date formats.
11+
12+
The behavior scans for date and datetime fields in the model attributes, and do the conversions needed.
13+
14+
Documentation
15+
=============
16+
17+
Requirements
18+
------------
19+
20+
Yii 1.0.9 or above
21+
You need to have defined your desired language at the entry script.
22+
Installation
23+
24+
Extract the release file and put it under protected/extensions
25+
26+
Usage
27+
-----
28+
29+
In you model, add the following code:
30+
```php
31+
public function behaviors()
32+
{
33+
return array('datetimeI18NBehavior' => array('class' => 'ext.DateTimeI18NBehavior')); // 'ext' is in Yii 1.0.8 version. For early versions, use 'application.extensions' instead.
34+
}
35+
```
36+
IMPORTANT! This behavior changes afterFind and beforeSave events. If your model have to have coding, please, don't forget to add the parent reference:
37+
```php
38+
protected function beforeSave(){
39+
if (!parent::beforeSave()) return false;
40+
....your code
41+
}
42+
```
43+
The same for afterFind method. Otherwise, this behavior will not make effect.
44+

0 commit comments

Comments
 (0)