summaryrefslogtreecommitdiff
path: root/framework/Util/TSimpleDateFormatter.php
diff options
context:
space:
mode:
authorknut <>2008-07-30 01:43:12 +0000
committerknut <>2008-07-30 01:43:12 +0000
commit411fbb72f5a4c72e43af08ee403c79c73eb4b53f (patch)
tree3915b0d98ca3c0608b56ad280cb08b8837a43dea /framework/Util/TSimpleDateFormatter.php
parentd15b608ef693c8dbc92c3a5f5ae826ca2812a61f (diff)
fixed #890
Diffstat (limited to 'framework/Util/TSimpleDateFormatter.php')
-rw-r--r--framework/Util/TSimpleDateFormatter.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php
index 8da02aa6..7e5ad415 100644
--- a/framework/Util/TSimpleDateFormatter.php
+++ b/framework/Util/TSimpleDateFormatter.php
@@ -189,10 +189,11 @@ class TSimpleDateFormatter
*/
public function isValidDate($value)
{
- if(is_null($value))
+ if($value === null) {
return false;
- else
- return !is_null($this->parse($value, false));
+ } else {
+ return $this->parse($value, false) !== null;
+ }
}
/**
@@ -254,7 +255,7 @@ class TSimpleDateFormatter
if ($token=='yy') { $x=2;$y=2; }
if ($token=='y') { $x=2;$y=4; }
$year = $this->getInteger($value,$i_val,$x,$y);
- if(is_null($year))
+ if($year === null)
return null;
//throw new TInvalidDataValueException('Invalid year', $value);
$i_val += strlen($year);
@@ -273,7 +274,7 @@ class TSimpleDateFormatter
$month=$this->getInteger($value,$i_val,
$this->length($token),2);
$iMonth = intval($month);
- if(is_null($month) || $iMonth < 1 || $iMonth > 12 )
+ if($month === null || $iMonth < 1 || $iMonth > 12 )
return null;
//throw new TInvalidDataValueException('Invalid month', $value);
$i_val += strlen($month);
@@ -284,7 +285,7 @@ class TSimpleDateFormatter
$day = $this->getInteger($value,$i_val,
$this->length($token), 2);
$iDay = intval($day);
- if(is_null($day) || $iDay < 1 || $iDay >31)
+ if($day === null || $iDay < 1 || $iDay >31)
return null;
//throw new TInvalidDataValueException('Invalid day', $value);
$i_val += strlen($day);
@@ -301,7 +302,7 @@ class TSimpleDateFormatter
}
if ($i_val != $this->length($value))
throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value);
- if(!$defaultToCurrentTime && (is_null($month) || is_null($day) || is_null($year)))
+ if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
return null;
else
{