Hey Thomas! Thx for the reply, yea, yesterday I figure it out the same, I was talking with the guys at #zftalk and "DASPRiD" told me the same, isDate doesn't check the string thing, thx for your help ^^.
----- Original Message ----- From: "Thomas Weidner" <[EMAIL PROTECTED]> To: "fw-general" <[email protected]> Sent: Thursday, June 12, 2008 1:21:57 AM GMT -05:00 Columbia Subject: Re: [fw-general] Zend_Date::isDate issue Juan, your code is wrong as you set the message for non-formatted dates but set a format before. Also you are using the ISO year instead of the real year. Could be problematic as long as you are not using as calendar representation. Related to isDate: There is a year 80 BC so it states that the date is correct. Zend_Date does only check if the date is correct, it does not check if the string is identical as this is useless for dates... yy is automatically converted to yyyy (the leading zeros are suppressed). Also for dates it is not relevant which seperator you are using... even if it's not "/" as declared by you, you will get a true as a date can be found which fit's the format. Keep in mind that Zend_Date can automatically detect the date and isDate does exactly reflect this. Why should isDate throw an error when the format can be detected ? :-) When you need a fixtation of string like if 2 digits are set and a "/" seperator then just add a validator which checks the string format additionally to the date. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com ----- Original Message ----- From: "Juan Felipe Alvarez Saldarriaga" <[EMAIL PROTECTED]> To: "fw-general" <[email protected]> Sent: Thursday, June 12, 2008 12:30 AM Subject: [fw-general] Zend_Date::isDate issue > Hello! :) > > I have an issue with Zend_Date, I mean, I'm using Zend_Form and creating a > Validator for a element date, so I have this: > > $objValidateDate = new Zend_Validate_Date( "MM/dd/YYYY" ); > $objValidateDate->setMessage( "'%value%' is not of the format MM/DD/YYYY", > Zend_Validate_Date::NOT_YYYY_MM_DD ); > $objElement->addValidator( $objValidateDate ); > > So, I don't know wich format use, so I test the isDate method from > Zend_Date, then I have this: > > Zend_Debug::dump( Zend_Date::isDate( "10/10/80", "MM/dd/yyyy" ) ); > > Look the format, I'm using the ISO table of constants, and look at the > return of Zend_Debug::dump: > > bool(true) > > How can return true if the year have just two digits ("10/10/80") ? and my > format have four ("MM/dd/yyyy") ? > > Thx for any help.
