Corrected date time detection (#1492)
* Corrected date time detection German and Swiss ZIP codes (special formats provided in German Excel versions) were detected as date time value, because the regular expression for date time formats falsely matched their formats ("\C\H\-00000" and "\D-00000").
This commit is contained in:
parent
acd2ba01df
commit
ca506ba87f
|
@ -387,6 +387,11 @@ class Date
|
|||
if ((substr($pFormatCode, 0, 1) == '_') || (substr($pFormatCode, 0, 2) == '0 ')) {
|
||||
return false;
|
||||
}
|
||||
// Some "special formats" provided in German Excel versions were detected as date time value,
|
||||
// so filter them out here - "\C\H\-00000" (Switzerland) and "\D-00000" (Germany).
|
||||
if (\strpos($pFormatCode, '-00000') !== false) {
|
||||
return false;
|
||||
}
|
||||
// Try checking for any of the date formatting characters that don't appear within square braces
|
||||
if (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $pFormatCode)) {
|
||||
// We might also have a format mask containing quoted strings...
|
||||
|
|
|
@ -150,4 +150,12 @@ return [
|
|||
true,
|
||||
'"date " y-m-d',
|
||||
],
|
||||
[
|
||||
false,
|
||||
'\C\H\-00000',
|
||||
],
|
||||
[
|
||||
false,
|
||||
'\D-00000',
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue