]> source.dussan.org Git - poi.git/commitdiff
60315 -- allow 'yyyy-MM-dd' as a valid date format in metadata in OPCParser
authorTim Allison <tallison@apache.org>
Fri, 28 Oct 2016 14:11:52 +0000 (14:11 +0000)
committerTim Allison <tallison@apache.org>
Fri, 28 Oct 2016 14:11:52 +0000 (14:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1767026 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java

index b8091973e95eaf1f86a5a67f6824166c73bb4928..6fb7f65be8dd639bcd1c421a86ace1295893a009 100644 (file)
@@ -55,6 +55,7 @@ public final class PackagePropertiesPart extends PackagePart implements
        private final static String[] DATE_FORMATS = new String[]{
                        DEFAULT_DATEFORMAT,
                        "yyyy-MM-dd'T'HH:mm:ss.SS'Z'",
+            "yyyy-MM-dd"
        };
 
        //Had to add this and TIME_ZONE_PAT to handle tz with colons.
@@ -635,7 +636,7 @@ public final class PackagePropertiesPart extends PackagePart implements
                if (date == null) {
                   return "";
                }
-               
+
                SimpleDateFormat df = new SimpleDateFormat(DEFAULT_DATEFORMAT, Locale.ROOT);
                df.setTimeZone(LocaleUtil.TIMEZONE_UTC);
                return df.format(date);
index 52ee4ffd83f5c129bf1c910361d3881a4b2ff729..b29d21fc0f8c75e0c4092ed79d5fda0e41709a13 100644 (file)
@@ -94,6 +94,9 @@ public final class TestPackageCoreProperties {
         props.setCreatedProperty("2007-05-12T06:00:00-0200");
         assertEquals(dateToInsert, props.getCreatedProperty().getValue());
 
+        props.setCreatedProperty("2015-07-27");
+        assertEquals(msdf.parse("2015-07-27T00:00:00.000Z"), props.getCreatedProperty().getValue());
+
         props.setCreatedProperty("2007-05-12T10:00:00.123+0200");
         assertEquals(msdf.parse("2007-05-12T08:00:00.123Z"), props.getCreatedProperty().getValue());