json - Date conversion in grails inside javascript -
i creating 1 date field in gsp below code using native grails date format:
<tr><td><label>delivery date: </label> <g:datepicker name="mydate" date="${new date()}" id="deldate" /></td></tr>
while catching date id in javascript, showing null. code follows:
var deldate=$('#deldate').val(); alert("date"+ deldate) showing dateundefined.
how can date in string format farther can pass json value.
thanks
of course of study doesn't work, since g:datepicker
tag translates 5 html <select>
(day, month, year,hour,minute).
my suggestion:
removeid="deldate"
attribute, reconstruct date way: class="snippet-code-js lang-js prettyprint-override">var d = new date($('#mydate_year').val(),$('#mydate_month').val(),$('#mydate_day').val(),$('#mydate_hour').val(),$('#mydate_minute').val(),$('#mydate_minute').val()); alert(d.tojson());
if want utilize specific date formatters suggest using moment.js
javascript json grails
No comments:
Post a Comment