JQuery datepicker control - how to increase/decrease the date by 1 day on button click
<p>I am not a JQuery expert and below is the use case i am expecting on my web page -</p>

<p>I Have a JQuery datepicker control embedded on the web page as below -</p>

<pre><code>&lt;input type="text" id="datepicker"&gt;
</code></pre>

<p>Converted to the Datepicker control -</p>

<pre><code>$(function() {
            var date = new Date();
            date.setDate(date.getDate() - 1);
            $("#datepicker").datepicker({
                dateFormat: "dd-mm-yy",
                defaultDate: date,
                onSelect: function () {
                    selectedDate = $.datepicker.formatDate("dd-mm-yy", $(this).datepicker('getDate'));
                    selDate = selectedDate;
                    console.log(selectedDate);
                }
            });
        });
</code></pre>

<p>Now its fine till now as i can see the control, fetch the date and all.</p>

<p>Problem starts when i place a next/prev button to increase and decrease the value of the datepicker by 1 day. Below is the code that i have put so far -</p>

<pre><code>$( "#datepicker" ).datepicker( "setDate", ($("#datepicker").datepicker('getDate').getDate() - 1));
</code></pre>

<p>I am calling the above code on click of a button.</p>

<p>As a result of this, date is changing but not by 1 day rather some random number of dates.</p>

<p>Not sure what exactly i am missing here and any help on this will be really useful.</p>

<p>I have been exploring a lot of related SO questions and also checked some of the solutions earlier accepted, but somehow they are not working correctly either.</p>

<p>Please suggest.</p>

<p>AJ</p>