Exception Nel Formattare Una Data

nel config main ho




language' => 'IT',



e sin ora usa




$out[$ts] = $formatter->format('MM yyyy', $ts);



dove $ts, ho già verificato, è un valido timestamp

passando dalla versione due cifre, a quella col nome del mese ottengo un errore




$out[$ts] = $formatter->format('MMM yyyy', $ts);	



"Fatal error: Call to a member function getMonthName() on a non-object in H:\xampp\htdocs\yii\framework\i18n\CDateFormatter.php on line 235"

Dove viene semplicemente eseguito questo




return $this->_locale->getMonthName($month,'abbreviated');



Io pensavo che avendo settato language in main.php fosse tutto a posto, difatti gli errori delle form submission sono correttamente mostrati in italiano.Dove sbaglio ?

Dove sbagli tu non lo so. Però mi chiedo come mai non usi DateTime di php. Mentre DateTime è stata testata, CDateFormatter evidentemente non lo è abbastanza. So che non risolvo il tuo problema, ma ti assicuro che non avresti problemi con DateTime().

DateTime non ha l’internazionalizzazione.

Cmq anche a me questo errore suona strano, stai usando Yii::app()->format o un formatter che hai generato tu? Credo che funzioni a dovere solo Yii::app()->format

Spiacente, ma …




CWebApplication and its behaviors do not have a method or closure named "format".



format non è un metodo di Yii:app() a quanto pare.