From 0ea568672e3a418fab4a7eef41e1e94f75a744b2 Mon Sep 17 00:00:00 2001 From: Romain Louis Date: Fri, 2 Nov 2007 03:12:37 +0000 Subject: [PATCH] Bad time formatting returns now null git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44168 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TimeField.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/forms/TimeField.php b/forms/TimeField.php index 3e399d127..40772ba95 100755 --- a/forms/TimeField.php +++ b/forms/TimeField.php @@ -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; } /**