Re: Mdy date validation fails for Sep instead of Sept
I came across the same problem ... The way I found to fix it was to
change line 403 in cake>libs>model>validation.php (Cakephp 1.3.4)
from
$regex['Mdy'] = '/^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|
Oct(ober)?|Dec(ember)?)\\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|
Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\\ (0?
[1-9]|([12]\\d)|30))|(Feb(ruary)?\\ (0?[1-9]|1\\d|2[0-8]|(29(?=,?\\
((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|
[3579][26])00)))))))\\,?\\ ((1[6-9]|[2-9]\\d)\\d{2}))$/';
to
$regex['Mdy'] = '/^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|
Oct(ober)?|Dec(ember)?)\\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|
Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|Sep(tember)?|(Nov|Dec)(ember)?)\\
(0?[1-9]|([12]\\d)|30))|(Feb(ruary)?\\ (0?[1-9]|1\\d|2[0-8]|(29(?=,?\\
((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|
[3579][26])00)))))))\\,?\\ ((1[6-9]|[2-9]\\d)\\d{2}))$/';
not recommended to mess with the core but it works.
On Aug 4, 5:03 pm, Brenda <rld0...@gmail.com> wrote:
> I have event_date in my model, with this validation rule:
>
> 'event_date' => array(
> 'rule' => array(
> 'date', array('Mdy')
> ),
> 'required' => true,
> 'allowEmpty' => false,
> 'message' => 'Please enter a valid date.'
> )
>
> Entering Sept 1, 2010 validates, but Sep 1, 2010 does not. Is that
> correct behavior?
>
> Thank you.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home