From fd019bf034ef4dbedfc305c77fed0dbd83a732c4 Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 25 Apr 2006 00:27:44 +0000 Subject: Add TListControlValidator. Update client-side validators, datepicker.js, colorpicker.js. Merge to 3.0 if necessary. --- framework/Util/TSimpleDateFormatter.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'framework/Util/TSimpleDateFormatter.php') diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php index 052e0074..2a3da63a 100644 --- a/framework/Util/TSimpleDateFormatter.php +++ b/framework/Util/TSimpleDateFormatter.php @@ -190,18 +190,20 @@ class TSimpleDateFormatter /** * Parse the string according to the pattern. - * @param string date string to parse + * @param string|int date string or integer to parse * @return int date time stamp * @throws TInvalidDataValueException if date string is malformed. */ public function parse($value,$defaultToCurrentTime=true) { - if(!is_string($value)) + if(is_int($value)) + return $value; + else if(!is_string($value)) throw new TInvalidDataValueException('date_to_parse_must_be_string', $value); if(empty($this->pattern)) return time(); - $date = $this->getDate(time()); + $date = time(); if($this->length(trim($value)) < 1) return $defaultToCurrentTime ? $date : null; -- cgit v1.2.3