diff options
author | xue <> | 2007-03-04 02:15:03 +0000 |
---|---|---|
committer | xue <> | 2007-03-04 02:15:03 +0000 |
commit | 5235271e1871d5cbedc852c5508c540a7143fc8d (patch) | |
tree | cf81adcf6717a106e48c4e8800fe16d204beef5c /framework/Web/UI/WebControls | |
parent | 902639d85f9ca13e54e04f9d2a59c691d4610195 (diff) |
Fixed #549.
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 1d7f780b..ca52523d 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -260,11 +260,14 @@ class TDatePicker extends TTextBox }
/**
- * @return integer current selected date from the date picker as timestamp.
+ * @return integer current selected date from the date picker as timestamp, NULL if timestamp is not set previously.
*/
public function getTimeStamp()
{
- return $this->getTimeStampFromText();
+ if(trim($this->getText())==='')
+ return null;
+ else
+ return $this->getTimeStampFromText();
}
/**
@@ -273,11 +276,14 @@ class TDatePicker extends TTextBox */
public function setTimeStamp($value)
{
- $date = TPropertyValue::ensureFloat($value);
- $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
- $this->getDateFormat());
- $d =$formatter->format($date);
- $this->setText($d);
+ if($value===null || (is_string($value) && trim($value)==='')
+ $this->setText('');
+ else
+ {
+ $date = TPropertyValue::ensureFloat($value);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$this->getDateFormat());
+ $this->setText($formatter->format($date));
+ }
}
/**
|