bnil
bnil

Reputation: 1541

How to add month range in datetime picker in MVC?

I am developing MVC app with razor. I am using date picker in it. I want to show previous 15 days and next 15 days should be enabled to choose. (I should able to choose date between 13 May to 13 june)

Which paramenter should I add in below code ?

 $(function () {
            $('#DueDate').datepicker({
                dateFormat: "dd-M-y",
                minDate:"Now",
                yearRange:"2011:2013",
                showWeek: true,
                changeMonth: true,
                changeYear: true,
                showOn: "button",
                buttonImage: '@Url.Content("~/Resource/Calender.jpg")',
                buttonImageOnly: true
            });
        });

Upvotes: 0

Views: 282

Answers (1)

Wouter
Wouter

Reputation: 36

Use the minDate and maxDate properties as explained here: http://api.jqueryui.com/datepicker/#option-maxDate

minDate: '-15d',
maxDate: '+15d'

Upvotes: 2

Related Questions