Number format mask test for dates: test for "General" format should be case-insensitive, and scientific format mask shouldn't return a positive for date

This commit is contained in:
Mark Baker 2013-10-28 19:05:26 +00:00
parent 6d21efc173
commit bff907a1b8

View File

@ -280,11 +280,14 @@ class PHPExcel_Shared_Date
* @return boolean * @return boolean
*/ */
public static function isDateTimeFormatCode($pFormatCode = '') { public static function isDateTimeFormatCode($pFormatCode = '') {
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
return FALSE;
if (preg_match('/0E[+-]0/i', $pFormatCode)) {
// Scientific format
return FALSE;
// Switch on formatcode // Switch on formatcode
switch ($pFormatCode) { switch ($pFormatCode) {
// General contains an epoch letter 'e', so we trap for it explicitly here
case PHPExcel_Style_NumberFormat::FORMAT_GENERAL:
return FALSE;
// Explicitly defined date formats // Explicitly defined date formats
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD: case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: