For pages with @DateField properties, when creating a page and setting a date during the creation process in the TouchUI, the following error shows up in the error.log in addition to the UI error message that pops up when attempting to save the page:
ERROR [0:0:0:0:0:0:0:1 [1447362379123] POST /libs/wcm/core/content/sites/createpagewizard/_jcr_content HTTP/1.1] libs.cq.gui.components.siteadmin.admin.createpagewizard.page.POST$jsp Error occur creating a new page
javax.jcr.ValueFormatException: Invalid date 2015-11-12
at org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl.createValue(ValueFactoryImpl.java:232)
at org.apache.jackrabbit.oak.jcr.session.NodeImpl.setProperty(NodeImpl.java:441)
at org.apache.jsp.libs.cq.gui.components.siteadmin.admin.createpagewizard.page.POST_jsp.writeContent(POST_jsp.java:124)
In ValueFactoryImpl.createValue it looks like it's running the following for dates:
if (ISO8601.parse(value) == null) {
throw new ValueFormatException("Invalid date " + value);
}
Currently, the DateField is set with the default storedFormat = "YYYY-MM-DD".
You can test how this fails in the groovy console:
(org.apache.jackrabbit.util.ISO8601.parse("2015-11-12") == null) ? "FAIL" : "SUCCESS"
However, the following succeeds:
(org.apache.jackrabbit.util.ISO8601.parse("2015-11-12T00:00:00.000-06:00") == null) ? "FAIL" : "SUCCESS"
If I update the DateField annotation to override the storedFormat then the page can be created without the error:
@DateField(storedFormat="YYYY-MM-DDThh:mm:ss.SSSZ")
So, for now we can override the storedFormat, but I'm guessing we probably want to change the default in the DateField annotation.
For pages with @DateField properties, when creating a page and setting a date during the creation process in the TouchUI, the following error shows up in the error.log in addition to the UI error message that pops up when attempting to save the page: ERROR [0:0:0:0:0:0:0:1 [1447362379123] POST /libs/wcm/core/content/sites/createpagewizard/_jcr_content HTTP/1.1] libs.cq.gui.components.siteadmin.admin.createpagewizard.page.POST$jsp Error occur creating a new page javax.jcr.ValueFormatException: Invalid date 2015-11-12 at org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl.createValue(ValueFactoryImpl.java:232) at org.apache.jackrabbit.oak.jcr.session.NodeImpl.setProperty(NodeImpl.java:441) at org.apache.jsp.libs.cq.gui.components.siteadmin.admin.createpagewizard.page.POST_jsp.writeContent(POST_jsp.java:124)
In ValueFactoryImpl.createValue it looks like it's running the following for dates: if (ISO8601.parse(value) == null) { throw new ValueFormatException("Invalid date " + value); }
Currently, the DateField is set with the default storedFormat = "YYYY-MM-DD". You can test how this fails in the groovy console: (org.apache.jackrabbit.util.ISO8601.parse("2015-11-12") == null) ? "FAIL" : "SUCCESS"
However, the following succeeds: (org.apache.jackrabbit.util.ISO8601.parse("2015-11-12T00:00:00.000-06:00") == null) ? "FAIL" : "SUCCESS"
If I update the DateField annotation to override the storedFormat then the page can be created without the error: @DateField(storedFormat="YYYY-MM-DDThh:mm:ss.SSSZ")
So, for now we can override the storedFormat, but I'm guessing we probably want to change the default in the DateField annotation.