Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

xtype datefield throws ValueFormatexception

Avatar

Level 1

Hello

 I'm trying to use the xtype datefield to my widget. After selecting the date and saving the dialog , I'm getting a "ValueFormatexception : Invalid date" warning alert and the data is not saved in the repository. 

 Below is the console exception.

org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
javax.jcr.ValueFormatException: Invalid date 05/15/15
    at org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl.createValue(ValueFactoryImpl.java:229)
    at org.apache.jackrabbit.oak.jcr.session.NodeImpl.setProperty(NodeImpl.java:437)
    at org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.store(SlingPropertyValueHandler.java:594)

 Any ideas on how to fix this please ?

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

what is the datefomat you have selected... I see the format of year is yy instead of yyyy and that might be the issue.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

what is the datefomat you have selected... I see the format of year is yy instead of yyyy and that might be the issue.

Avatar

Level 1

bsloki wrote...

what is the datefomat you have selected... I see the format of year is yy instead of yyyy and that might be the issue.

 

Hi Lokesh

  Thanks for your reply

   I haven't selected any format, left that to a default format - 'm/d/Y' . If i make the format as 'Y-m-d' the content is getting stored with Date format as per ISO8601 standards. Overall i want to save the date in a String format.

 

Thank you