Skip to content

Commit 19530d8

Browse files
committed
#33 - return value from createFromFormat()
1 parent f01a94a commit 19530d8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/TgUtils/Date.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@ public static function createFromFormat($format, $timeString, $timezone = null)
423423
$timezone = new \DateTimeZone($timezone);
424424
}
425425
$d = \DateTime::createFromFormat($format, $timeString, $timezone);
426-
return self::createLocalInstance((int)$d->format('U'), $timezone);
426+
if ($d !== FALSE) {
427+
return self::createLocalInstance((int)$d->format('U'), $timezone);
428+
}
429+
return FALSE;
427430
}
428431

429432
public static function createFromMysql($timeString, $timezone = null) {

0 commit comments

Comments
 (0)