Bad time formatting returns now null

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44168 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Romain Louis 2007-11-02 03:12:37 +00:00
parent 4c76be62c9
commit 0ea568672e

View File

@ -25,8 +25,11 @@ class TimeField extends TextField {
* Change the setValue to store the time (in a datetime field)
* we store the current date as well (although we don't use it for this field)
*/
function setValue($val) {
$this->value = (date("Y-m-d",time()) . " " . date("H:i",strtotime($val)) );
function setValue( $val ) {
if( $val )
$this->value = (date("Y-m-d",time()) . " " . date("H:i",strtotime($val)) );
else
$this->value = null;
}
/**