From bff907a1b8d00a69f480e9923176c7f744965b08 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 28 Oct 2013 19:05:26 +0000 Subject: [PATCH] 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 --- Classes/PHPExcel/Shared/Date.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel/Shared/Date.php b/Classes/PHPExcel/Shared/Date.php index fe8fc6a..4bae5f2 100644 --- a/Classes/PHPExcel/Shared/Date.php +++ b/Classes/PHPExcel/Shared/Date.php @@ -280,11 +280,14 @@ class PHPExcel_Shared_Date * @return boolean */ 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 ($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 case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD: case PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2: