jquery - Why date format is not changed in datepicker? -
i have used jquery-ui-1.7.2 datepicker in code. want change date in 'yy-mm-dd' format. doesn't change , takes default value.
here code:
<div id='mydate'> <input type="text" id="monthinput" class="form-control" name="water.month" value="${water?.month}" /> </div>
and jquery:
var = new date(); var prevmonthfirstdate = new date(now.getfullyear() - (now.getmonth() > 0 ? 0 : 1), (now.getmonth() - 1 + 12) % 12, 1); var prevmonthlastdate = new date(now.getfullyear(), now.getmonth(), 0); $('#monthinput').datepicker({ altformat: 'yy-mm-dd', dateformat: 'yy-mm-dd', startdate: prevmonthfirstdate, enddate: prevmonthlastdate });
what should do?
use dateformat property instead of altformat
$('#monthinput').datepicker({ dateformat: 'yy-mm-dd' });
wiki
Comments
Post a Comment