Bug fix date parsing (thanks to @skasi7)

This commit is contained in:
Frédéric Guillot 2013-12-17 21:42:22 -05:00
parent d92f201fdc
commit 61b12ab4d7

View File

@ -140,8 +140,16 @@ abstract class Parser
$value = trim($value);
foreach ($formats as $format => $length) {
$timestamp = $this->getValidDate($format, substr($value, 0, $length));
if ($timestamp > 0) return $timestamp;
$truncated_value = $value;
if ($length !== null) {
$truncated_value = substr($truncated_value, 0, $length);
}
$timestamp = $this->getValidDate($format, $truncated_value);
if ($timestamp > 0) {
return $timestamp;
}
}
return time();