rall0r
(Rall0r)
September 1, 2011, 10:17am
1
Hi,
i’m using the CJuiDatepicker with an different dateFormat. So the user has the possibility to add an time:
$this->widget('zii.widgets.jui.CJuiDatePicker',
array('model'=>$model,
'options'=>array('showAnim'=>'fold',
'constrainInput'=>false,
'dateFormat'=>'dd.mm.yy 00:00'),
[....]
So the datepicker generates an value like this: "01.09.2011 00:00" and the user is able to change to "01.09.2011 09:54".
Next step is to validate this value using the following rule:
array(‘STARTDATE’, ‘type’, ‘type’=>‘datetime’, ‘datetimeFormat’=>‘dd.mm.yyyy hh:mm’),
But it dies not work. "STARTDATE" is not valid?!
Is there any typo or may i misunderstood the documentation (http://www.yiiframework.com/doc/api/1.1/CTypeValidator )
Thank you!
rall0r
mdomba
(Maurizio Domba Cerin)
September 1, 2011, 10:31am
2
Not sure if that is the problem… but as the documentation for CDateTimeParser say - http://www.yiiframework.com/doc/api/1.1/CDateTimeParser
mm means minutes, use MM for months
rall0r
(Rall0r)
September 1, 2011, 11:03am
3
absolutely - that’s it!
Thank you so much!
I was confused because of the Javscript Date Format from the DatePicker. There mm means minutes.
However mm or MM if i look at the old (and worng) format string: dd.mm.yyyy hh:mm <- now i’m notice, that i’m using mm for minutes AND months - in every case, that will never work exactly!
Thank you!