Is there a way to get the date from the jquerymobile’s datebox as Date Object??
Because when I try to get the value of the datebox it comes as string. Later I did some operation to reduce the date by 1 and show it again in the dae box. But it’s working in chrome but not in iPad’s browser 🙁
datebox
<input name="difereddelv" id="datepickerAct" type="date" data-role="datebox" data-options='{"mode": "calbox"}'> <br/>
button click function
$("#btnPrevDate").bind("click", function(){
var myDate = $('#datepickerAct').val();
console.log(myDate);
var today = new Date(myDate);
console.log(today);
today = new Date(today.getTime() - (24 * 60 * 60 * 1000));
console.log(today );
$('#datepickerAct').val($('#datepickerAct').data('datebox')._formatter('YYYY-mm-DD', today));
console.log($('#datepickerAct').data('datebox')._formatter('YYYY-MM-DD', today));
});
Can someone tell me please, how to get the date of the datebox and reduce it by 1 and show it again in the datebox textbox??
You can get the date as
Dateobject with$('#myDateInput').data('datebox').theDate;, wheremyDateInputis the id of your input which has the attributedata-role="datebox".