diff --git a/www/js/custom/elements.js b/www/js/custom/elements.js index 8c47c13..55f3cf7 100644 --- a/www/js/custom/elements.js +++ b/www/js/custom/elements.js @@ -1,12 +1,6 @@ jQuery.noConflict(); jQuery(document).ready(function(){ - /** - * Date picker - **/ - jQuery( "#datepicker" ).datepicker(); - - /** * Growl Notification **/ diff --git a/www/protected/models/Candidato.php b/www/protected/models/Candidato.php index 18bfdc9..f853373 100644 --- a/www/protected/models/Candidato.php +++ b/www/protected/models/Candidato.php @@ -172,7 +172,7 @@ class Candidato extends CActiveRecord array('fecha_nacimiento, observaciones', 'safe'), - //array('fecha_nacimiento', 'date', 'allowEmpty'=>'true'), + array('fecha_nacimiento', 'date', 'format'=>'dd/MM/yyyy'), array('estado', 'unsafe'), @@ -297,4 +297,25 @@ class Candidato extends CActiveRecord return parent::beforeValidate(); } + + protected function beforeSave() + { + //PHP dates are displayed as dd/mm/yyyy + //MYSQL dates are stored as yyyy-mm-dd + $unafecha = DateTime::createFromFormat('d/m/Y', $this->fecha_nacimiento); + $this->fecha_nacimiento = $unafecha->format('Y-m-d'); + + parent::beforeSave(); + return true; + } + + protected function afterFind() { + //PHP dates are displayed as dd/mm/yyyy + //MYSQL dates are stored as yyyy-mm-dd + $unafecha = DateTime::createFromFormat('Y-m-d', $this->fecha_nacimiento); + $this->fecha_nacimiento = $unafecha->format('d/m/Y'); + + parent::afterFind(); + return true; + } } \ No newline at end of file diff --git a/www/protected/views/candidato/_form.php b/www/protected/views/candidato/_form.php index 37aed29..d07f654 100644 --- a/www/protected/views/candidato/_form.php +++ b/www/protected/views/candidato/_form.php @@ -94,7 +94,24 @@ Yii::app()->clientScript->registerScript('wysiwyg', $script, CClientScript::POS_