I have a text input that uses custom date and time picker script.
<div class="input-group date datetime" data-start-view="4" data-date-format="dd MM yyyy" data-min-view="2" data-link-field="dtp_input1">
<input name="dateOfBirth" class="form-control" size="16" type="text" value="${userInstance?.dateOfBirth}"/>
<span class="input-group-addon btn btn-primary"><span class="glyphicon glyphicon-th"></span></span>
</div>
It gives me this error
Property org.springframework.context.support.DefaultMessageSourceResolvable: codes [rms.User.dateOfBirth,dateOfBirth]; arguments []; default message [dateOfBirth] must be a valid Date
I dont how to solve this. Using the grails dateTime picker tag seems to work but its ugly
The only way is to use
SimpleDateFormat
. I often use it for forms with a JS-calendar inside:UPDATE:
You must use the propper date format of course. The one I gave in my example
dd.MM.yyyy
corresponds to08.02.2014
. For strings likeFebruary 08 2014
you are gonna need something likeMMM dd yyyy
.See http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html for further info