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
1 changed files with 10 additions and 2 deletions

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();