Browse Source

return default if null

Mark Scherer 9 years ago
parent
commit
0df0e8db51
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/Utility/Time.php

+ 4 - 0
src/Utility/Time.php

@@ -550,6 +550,10 @@ class Time extends CakeTime {
 			$options['timezone'] = static::safeCreateDateTimeZone($options['timezone']);
 		}
 
+		if ($dateString === null) {
+			return $options['default'];
+		}
+
 		if (!is_object($dateString)) {
 			$date = new DateTime($dateString, $options['timezone']);
 		} else {