Revision: 663
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=663&view=rev
Author: michieltcs
Date: 2012-05-03 19:41:43 +0000 (Thu, 03 May 2012)
Log Message:
-----------
Use a (more) sensible year range
Modified Paths:
--------------
trunk/library/classes/MUtil/Validate/Date/IsDate.php
Modified: trunk/library/classes/MUtil/Validate/Date/IsDate.php
===================================================================
--- trunk/library/classes/MUtil/Validate/Date/IsDate.php 2012-05-03 19:24:09 UTC (rev 662)
+++ trunk/library/classes/MUtil/Validate/Date/IsDate.php 2012-05-03 19:41:43 UTC (rev 663)
@@ -73,12 +73,12 @@
public function isValid($value, $context = null)
{
$date = new Zend_Date($value, $this->getDateFormat());
+ $year = $date->get(Zend_Date::YEAR);
/**
- * Prevent dates with a year > 9999 as this will cause errors
- * when saving to the db
+ * Prevent extreme dates (also fixes errors when saving to the db)
*/
- if ($date->get(Zend_Date::YEAR) < 10000 && Zend_Date::isDate($value, $this->getDateFormat())) {
+ if ($year > 1850 && $year < 2200 && Zend_Date::isDate($value, $this->getDateFormat())) {
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|