diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 20 |
2 files changed, 14 insertions, 7 deletions
@@ -3,6 +3,7 @@ Version 3.1.0 beta to be released BUG: Ticket#492 - TDataGridPagerStyle not found error (Qiang) BUG: Ticket#517 - Quickstart I18N sample: conflicting module ID (Wei) BUG: Ticket#521 - comment tag on TActiveButton stop callback (Wei) +BUG: Ticket#549 - set/get Timestamp on TDatePicker shound handle "null" values (Qiang) BUG: Ticket#553 - I18N quickstart sample does not work (Qiang) BUG: TXmlElement did not encode attribute and text values when being saved as a string (Qiang) BUG: SelectedIndices not return expected result for ActiveListBox (Wei) 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));
+ }
}
/**
|