[fw-general] Re: Zend_Date Behavior: PEBKAC or Bug?

2011-03-03 Thread David Muir
Zend_Date is next to useless for validating dates:
http://framework.zend.com/issues/browse/ZF-7583

You're better off building your own date validator.

Cheers,
David

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Date-Behavior-PEBKAC-or-Bug-tp3331849p3332840.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Re: Zend_Date Behavior: PEBKAC or Bug?

2011-03-03 Thread Ryan Lange
On Thu, Mar 3, 2011 at 1:57 AM, David Muir davidkmuir+z...@gmail.comwrote:

 Zend_Date is next to useless for validating dates:
 http://framework.zend.com/issues/browse/ZF-7583


Well, that confirms that. Thanks.


 You're better off building your own date validator.


Everything seems to work as expected as long as you make sure the date is in
the expected format (in my case, by inserting a Zend_Validate_Regex rule
before Zend_Validate_Date).

For example, with that setup, an input of 29.2.2008 (February 29, 2008, a
leap year) validates, while an input of 29.2.2009 (February 29, 2009, not
a leap year) fails validation, as expected. An input of 2.29.2011 throws
an exception (Unable to parse date '2.29.2011' using 'd.M.' (M  d)),
which is also expected.

It's apparently the format that's near useless for validation. It's only
seems to be good for hinting at the order in which the various parts should
appear in the input.


Ryan