Ramesh
Ramesh

Reputation: 35

jQuery date picker: limit certain months and limit current month upcoming days

i am trying to reject current month upcoming days. that is i want to show only upto current day date. example show only upto 13/9/2013. how to do that in jquery. show me an example code for that.also the date picker show only past three month dates.

<script type="text/javascript">
    $(document).ready(function () {
        $("#<%=txtFrmdate.ClientID %>").dynDateTime({
            showsTime: true,
            ifFormat: "%d/%m/%y %H:%M",
            daFormat: "%l;%M %p, %e %m, %Y",
            align: "BR",
            electric: false,
            singleClick: false,
            displayArea: ".siblings('.dtcDisplayArea')",
            button: ".next()"
        });
    });

Upvotes: 0

Views: 3390

Answers (3)

DevlshOne
DevlshOne

Reputation: 8457

$( "#datepicker" ).datepicker({ minDate: -"-3M", maxDate: "+0D" });

Where "-3M" is "three months in the past" and "+0D" is "no dates in the future".

Upvotes: 2

BenM
BenM

Reputation: 4278

http://api.jqueryui.com/datepicker/

Some example code there for you. As well as the full API.

Upvotes: 1

Andy
Andy

Reputation: 3012

This might work:

$(function() {
    $( "#datepicker" ).datepicker({ minDate: "-3M", maxDate: "+0D" });
});

So your code would become:

$(document).ready(function () {
    $("#<%=txtFrmdate.ClientID %>").dynDateTime({
        showsTime: true,
        ifFormat: "%d/%m/%y %H:%M",
        daFormat: "%l;%M %p, %e %m, %Y",
        align: "BR",
        electric: false,
        singleClick: false,
        displayArea: ".siblings('.dtcDisplayArea')",
        button: ".next()",
        minDate: "-3M", 
        maxDate: "+0D"

    });
});

Upvotes: 1

Related Questions