浏览代码

return default if null

Mark Scherer 9 年之前
父节点
当前提交
0df0e8db51
共有 1 个文件被更改,包括 4 次插入0 次删除
  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 {