From 3ad074e9410153fefaa2343165a68a355400fd6e Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 21 Apr 2006 12:58:38 +0000 Subject: removed exceptions from simple date formatter --- framework/Util/TSimpleDateFormatter.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'framework/Util') diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php index 7be49bc9..052e0074 100644 --- a/framework/Util/TSimpleDateFormatter.php +++ b/framework/Util/TSimpleDateFormatter.php @@ -246,7 +246,8 @@ class TSimpleDateFormatter if ($token=='y') { $x=2;$y=4; } $year = $this->getInteger($value,$i_val,$x,$y); if(is_null($year)) - throw new TInvalidDataValueException('Invalid year', $value); + return null; + //throw new TInvalidDataValueException('Invalid year', $value); $i_val += strlen($year); if(strlen($year) == 2) { @@ -264,7 +265,8 @@ class TSimpleDateFormatter $this->length($token),2); $iMonth = intval($month); if(is_null($month) || $iMonth < 1 || $iMonth > 12 ) - throw new TInvalidDataValueException('Invalid month', $value); + return null; + //throw new TInvalidDataValueException('Invalid month', $value); $i_val += strlen($month); $month = $iMonth; } @@ -274,14 +276,16 @@ class TSimpleDateFormatter $this->length($token), 2); $iDay = intval($day); if(is_null($day) || $iDay < 1 || $iDay >31) - throw new TInvalidDataValueException('Invalid day', $value); + return null; + //throw new TInvalidDataValueException('Invalid day', $value); $i_val += strlen($day); $day = $iDay; } else { if($this->substring($value, $i_val, $this->length($token)) != $token) - throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value); + return null; + //throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value); else $i_val += $this->length($token); } -- cgit v1.2.3