General should not be interpreted as a date format for number cells (fix issue #212)

This commit is contained in:
Ilya Pleshakov 2016-05-12 16:39:48 +03:00
parent e9cd7a397e
commit 33deb10aa7
2 changed files with 5 additions and 0 deletions

View File

@ -201,6 +201,10 @@ class StyleHelper
$customNumberFormat = $customNumberFormats[$numFmtId];
if ($customNumberFormat === 'General') {
return false;
}
// Remove extra formatting (what's between [ ], the brackets should not be preceded by a "\")
$pattern = '((?<!\\\)\[.+?(?<!\\\)\])';
$customNumberFormat = preg_replace($pattern, '', $customNumberFormat);

View File

@ -111,6 +111,7 @@ class StyleHelperTest extends \PHPUnit_Framework_TestCase
['m/d/yyyy;@', true],
['[$-409]m/d/yy\--h:mm;@', true],
['GENERAL', false],
['General', false],
['\ma\yb\e', false],
['[Red]foo;', false],
];