Yii Framework Forum: CJuiDatePicker, I18n and date columns... - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CJuiDatePicker, I18n and date columns... Rate Topic: -----

#1 User is offline   warden 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 16-April 11

Posted 05 June 2011 - 11:19 AM

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' )));
		 ?>

0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,082
  • Joined: 16-February 11
  • Location:Japan

Posted 06 June 2011 - 01:11 AM

Hi,

Did you try the "language" property? CJuiDatePicker::language
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users