Shouldn’t
<?php $this->widget('zii.widgets.jui.CJuiDatePicker',
array('model' => $model,'attribute'=>'date'));
?>
be using I18n date format definition?
When I am now switching between locales, I need to write proper afterFind() and beforeSave methods… like this:
/* (non-PHPdoc)
* @see CActiveRecord::afterFind()
*/
protected function afterFind(){
$this->date = Yii::app()->dateFormatter->format("d.M.yyyy",$this->date);
return parent::afterFind();
}
/* (non-PHPdoc)
* @see CActiveRecord::beforeSave()
*/
protected function beforeSave(){
$this->date = Yii::app()->dateFormatter->format("yyyy-M-d",$this->date);
return parent::beforeSave();
}
AND additionaly I have to set manually the format in the widget:
<?php $this->widget('zii.widgets.jui.CJuiDatePicker',
array('model' => $model,'attribute'=>'date', 'options'=>array('dateFormat' => 'd.mm.yy' )));
?>