Hi!
I’m quite new to Yii and so far I’m quite impressed. I was also impressed when I saw how easy it is to integrate things like a cool-looking Datepicker. But then the problems began. I’m using Yii 1.1 RC.
I’ve localized my application and thus my date attributes are in the form “dd.mm.yyyy” (like 29.12.2009). Now I’m not quite sure where the conversion from a date as it is stored in the database (SQlite seems to accept even that German date format) to a date in the form “dd.mm.yyyy” should occur. I thought CActiveRecord might do that, but apparently there are still things I don’t really understand and that might even be a bug. First of all I expect the date the user enters to be in the form “dd.mm.yyyy”. That’s why I’ve also set a validation rule as follows:
array('begin, end', 'type', 'type' => 'date', 'dateFormat' => Yii::app()->getLocale()->getDateFormat())
. And this is also the format the CJuiDatePicker produces when I set it’s language to “de”. But then that’s of course also the format that is again put into input as value. But whenever a date in the format “dd.mm.yyyy” is set as value in the input form, the date picker transforms it into the current date during initialization. When I manually enter the date in the format “2009/12/24”, the date picker takes that date and transforms it into the German date format during initialization. So either the date format is set too late (e.g. only after the initialization has already taken place) or I haven’t understood how Yii expects me to handle different date formats (as I also rather want to have a date in a form like 2009-12-29 in the model in order to be able to e.g. sort it properly).
Greetings
Michael