BUGFIX #4566 Time::Nice() and Time::Nice24() return bad results if there is no value

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@94353 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-12-03 04:22:13 +00:00 committed by Sam Minnee
parent 52abe83a2b
commit abab0dd631

View File

@ -25,7 +25,7 @@ class Time extends DBField {
* @return string Time in 12 hour format
*/
function Nice() {
return date('g:ia', strtotime($this->value));
if($this->value) return date('g:ia', strtotime($this->value));
}
/**
@ -35,7 +35,7 @@ class Time extends DBField {
* @return string Time in 24 hour format
*/
function Nice24() {
return date('H:i', strtotime($this->value));
if($this->value) return date('H:i', strtotime($this->value));
}
/**