Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Datepicker from Granite Foundation - How do you change the property type to Date instead of String

Avatar

Level 1

I am using the datepicker component (granite/ui/components/foundation/form/datepicker) for a new field in the Touch UI, but it saves it as a String property in the node, rather than a Date.  We do querybuilder searches with Dates, and it doesn't seem to work when that field is a String, but it works as a date.

How do I change it so that this component saves this value with type Date rather than String?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Another option that you can do is to take the String returned from the component and convert the value to a Date via JavaScript. See: 

http://www.mattkruse.com/javascript/date/

Then you can assign that Date value to the JCR node.  

View solution in original post

2 Replies

Avatar

Level 10

did you tried adding an hidden variable @TypeHint of type date?

Avatar

Correct answer by
Level 10

Another option that you can do is to take the String returned from the component and convert the value to a Date via JavaScript. See: 

http://www.mattkruse.com/javascript/date/

Then you can assign that Date value to the JCR node.