I am using jquery ui datepicker in a form in my project. I am initializing datepicker like this.
var date_lower = new Date(1910,0,1);
var year_lower = date_lower.getFullYear();
var date_upper = new Date();
var year_upper = date_upper.getFullYear();
$("#id_dob").datepicker({ dateFormat: 'mm-dd-yy',minDate: date_lower,
maxDate: date_upper ,
yearRange: year_lower+':'+year_upper ,
changeYear: true,
changeMonth: true,
defaultDate: new Date(2000,01,01)
});
My date format is like this 'mm-dd-yy'. So datepicker does not allow me to enter date in 'mm/dd/yy' format. When I try to type '/' in datepicker input, it does nothing or I cannot type '/' in datepicker input field. I am doing this because I want to give user option to add date without using calander too (It is client's demand). I want that to set date format so that I can use any separater from [./-\s]
. For example I want all these type of dates (01-01-1999, 01/01/1999, 01.01.1999 and 01 01 1999) to be accepted. Can any one tell me how I can do this?
I am using Django model formsets.