Javascript checking date
<p>I am trying to use JavaScript to validate that the date selected is not earlier than today, but when I select today's date it's showing the alert box. </p>

<p>JavaScript:</p>

<pre><code>function checkDueDate(sender, args) {
    var td = new Date(); 
    td.setMinutes(59);
    td.setSeconds(59);
    td.setHours(23);
    //to move back one day
    td.setDate(td.getDate() - 1);

    if (sender._selectedDate &lt; td) {
        alert("You can't select day from the past! " + td + "");
        sender._selectedDate = new Date();
        // set the date back to the current date
        sender._textbox.set_Value(sender._selectedDate.format(sender._format))
    }
</code></pre>

<p>ASP.NET:</p>

<pre><code>        &lt;asp:TextBox ID="txtDueDate" runat="server"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:CalendarExtender ID="txtDueDate_CalendarExtender" runat="server" 
            TargetControlID="txtDueDate" OnClientDateSelectionChanged="checkDueDate"&gt;
        &lt;/asp:CalendarExtender&gt;
</code></pre>

<p><img src="http://i.stack.imgur.com/RX9R8.png" alt="Image"></p>
