I want to set the date-picker to show only the current month and user cannot move to previous months or next months.Is there any in build function for it?
You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 . Dates that appears outside the minimum and maximum date range will be disabled (blackout).
DateRangePicker can be inactivated on a page, by setting enabled value as false that will disable the component completely from all the user interactions including in form post.
The requirement is also to be able to use dates in the format "dd-MMM-yy". For example, in the first date field, the user selects 26-Nov-16. Then, when they click on the date picker for the second date field, the earliest date they are able to select is 26 Nov.
Use changeMonth:false
and stepMonths:0
and it will work.
$('#calendar').datepicker({
changeMonth: false,
stepMonths: 0,
dateFormat: "mm/dd/yy",
firstDay: 1,
}).datepicker("setDate", "+0d" );
Working fiddle: https://jsfiddle.net/scottcwilson/phkkt20e/2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With