altFormat with CJuiDatePicker

How do I use the JQuery altFormat property with CJuiDatePicker?

I thought this would be easy to do but I cannot see it in the documentation.

Futher update …

I have tried this and it half works …


<?php $this->widget("zii.widgets.jui.CJuiDatePicker", array("name" => "Time[date]", "value" => $data->date, "defaultOptions" => array("altFormat" => "yyyy-mm-dd"))); ?><br /><br />

The altFormat works and is submitting correctly, however the writing in the datepicker has gone to Chinese?

This is reported bug recently (about switch to chinese lang):

http://code.google.com/p/yii/issues/detail?id=2544

Try to set language with empty string for CJuiDatePicker’s options:




...

'language' = Yii::app()->language == 'en' ? '' : Yii::app()->language;

...



lubos

this article may help you http://stackoverflow.com/questions/4392097/altformat-not-working-in-jquery-datepicker-input-field

I also had a hard time getting the behavior I wanted out of the CJuiDatePicker.

It finally occurred to me that the only time I wanted the date in ISO was when it was being stored/fetched from the database - otherwise I always was working with it as a US style date. Since it is always presented to the user as a US date, there shouldn’t be an instance where a search is done expecting the date in ISO format. So I figured I could just modify the search function to convert the date within the model from one to the other (and to only do so if it is null, otherwise it gave the good 'ol 1963 date).

I can’t see a reason why this would be a problem, if anyone else does please let me know. It has made everything work the way I want it to for my current project and made things even beyond the CJuiDatePicker easier to work with :)

Anyway, figured I’d register and post this ramble since it tackles the same problem from a different angle - and there really wasn’t anything I could find that worked for me already out there.