How can I allow a user to answer dates before 1970 into a JQuery UI DatePicker widget?
I'm working on a site that uses a Jquery UI datepicker to allow users to enter their date of birth. However, since the calender (intialized as follows), doesn't go before December 31st 1969, this will prevent users born before then from registering. How can I make it so that the date goes back all the w开发者_运维技巧ay to 1910 like intended?
picker.datepicker({
defaultDate: (field.val() ? new Date(field.val() * 1000) : '-13y'),
dateFormat: '@',
changeMonth: true,
changeYear: true,
yearRange: '1910:2000',
minDate: '1910-01-01'
});
Ugh... figured it out myself.
The minDate I gave it was an ISO 8601 date, but it was expecting a UNIX timestamp.
Changing it to -1893434400
made the picker work.
精彩评论