jQuery UI Date Picker min and max dates

maqskywalker
maqskywalker used Ask the Experts™
on
Hi experts,

I'm using the jQuery UI DatePicker on a html page.

I saw the Restrict Date Range example at this url.
http://jqueryui.com/datepicker/#min-max

This is example is the same as the Restrict Date Range example.
http://jsfiddle.net/zk9ku9cr/

The min date is to 20 days prior to today's date.


Anyone know how i set the min date to be the first day of the current year and the max date to be the last date of the current year?

So since the current year is 2015  the min date is  01/01/2015 and the max date is 12/31/2015?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Commented:
Try this:
            $("#datepicker").datepicker({
                minDate: new Date((new Date()).getFullYear(), 1 - 1, 1),
                maxDate: new Date((new Date()).getFullYear(), 12 - 1, 31)
            });

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial