SLING-9983 - Add support for predefined date format styles
* added test content
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java b/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java
new file mode 100644
index 0000000..394d68b
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/format/FormatPojo.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package apps.sightly.scripts.format;
+
+import java.util.Date;
+
+public class FormatPojo {
+
+ // 1918-12-01 00:00:00.000Z
+ private Date date = new Date(-1612137600000l);
+
+ public Date getDate() {
+ return date;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html b/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html
new file mode 100644
index 0000000..790144a
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/format/format.html
@@ -0,0 +1,22 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<div id="format" data-sly-use.pojo="FormatPojo">
+<p id="format-date-1">${'DEFAULT' @ format=pojo.date, timezone='UTC', locale='de_DE', type='date'}</p>
+<p id="format-date-2">${'short' @ format=pojo.date, timezone='UTC', locale='de_DE', type='date'}</p>
+<p id="format-date-3">${'short' @ format=pojo.date, timezone='UTC', locale='de_DE'}</p>
+<p id="format-date-4">${'FULL' @ format=pojo.date, timezone='UTC', locale='de_DE', type='date'}</p>
+</div>
\ No newline at end of file
diff --git a/src/main/resources/SLING-INF/content/sightly.json b/src/main/resources/SLING-INF/content/sightly.json
index d7dbde6..fbab8f4 100644
--- a/src/main/resources/SLING-INF/content/sightly.json
+++ b/src/main/resources/SLING-INF/content/sightly.json
@@ -57,6 +57,10 @@
"jcr:primaryType": "sling:Folder",
"data": "foobar-somefolder"
},
+ "format": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "/apps/sightly/scripts/format"
+ },
"i18n": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType" : "/apps/sightly/scripts/i18n"