From: Nick Burch Date: Fri, 18 Jul 2008 17:16:50 +0000 (+0000) Subject: Patch from bug #45398 - Support detecting date formats containing "am/pm" as date... X-Git-Tag: REL_3_2_FINAL~232 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6cc974bd7280a7f685499d13b48c78b22803be98;p=poi.git Patch from bug #45398 - Support detecting date formats containing "am/pm" as date times git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@677974 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 3e37911e84..caa238df59 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 45398 - Support detecting date formats containing "am/pm" as date times 45410 - Removed dependency from contrib on commons beanutils,collections and lang New helper, HSSFOptimiser, which handles removing duplicated font and style records, to avoid going over the limits in Excel 45322 - Fixed NPE in HSSFSheet.autoSizeColumn() when cell number format was not found diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 511b570a2d..798d358294 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 45398 - Support detecting date formats containing "am/pm" as date times 45410 - Removed dependency from contrib on commons beanutils,collections and lang New helper, HSSFOptimiser, which handles removing duplicated font and style records, to avoid going over the limits in Excel 45322 - Fixed NPE in HSSFSheet.autoSizeColumn() when cell number format was not found diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java b/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java index be590c3a2d..ab353ca02c 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java @@ -231,7 +231,7 @@ public class HSSFDateUtil // Otherwise, check it's only made up, in any case, of: // y m d h s - / , . : // optionally followed by AM/PM - if(fs.matches("^[yYmMdDhHsS\\-/,. :]+[ampAMP]*$")) { + if(fs.matches("^[yYmMdDhHsS\\-/,. :]+[ampAMP/]*$")) { return true; } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java index 2ac4eb825f..894c77d685 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java @@ -273,7 +273,8 @@ public class TestHSSFDateUtil extends TestCase { "yyyy-mm-dd hh:mm:ss", "yyyy/mm/dd HH:MM:SS", "mm/dd HH:MM", "yy/mmm/dd SS", "mm/dd HH:MM AM", "mm/dd HH:MM am", - "mm/dd HH:MM PM", "mm/dd HH:MM pm" + "mm/dd HH:MM PM", "mm/dd HH:MM pm", + "m/d/yy h:mm AM/PM" }; for(int i=0; i