Datepicker from Granite Foundation - How do you change the property type to Date instead of String | Community
Skip to main content
October 16, 2015
Solved

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

  • October 16, 2015
  • 2 replies
  • 731 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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.  

2 replies

Sham_HC
Level 10
October 16, 2015

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

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

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.