I must be missing some setting or something, but when I use the back button the datepicker jumps to 1899 from the current year.
Has anyone else seen this and fixed it?
(You can see the different combos I've commented out.)
$('.dialog-search,#from')
.datepicker({
defaultDate: 'c-1m',
dateFormat: 'yymmdd',
//changeMonth: true,
changeYear: true,
showAnim: 'fadeIn',
duration: 200,
//gotoCurrent: true,
showOtherMonths: true,
selectOtherMonths: true,
currentText: 'Now',
shortYearCutoff: '+20',
//showWeek: true,
//firstDay: 1,
numberOfMonths: 1,
showButtonPanel: true,
yearRange: 'c-200:c',
onSelect: function(selectedDate,inst) {
$('.dialog-search,#from').val(selectedDate);
}
});
inside the jQuery script code just paste the code. $( ". selector" ). datepicker({ dateFormat: 'yy-mm-dd' });
An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field.
By default DatePicker has standard height and width (height: '30px' and width: '143px'). You can change this height and width by using height and width property respectively.
I had this issue when I had multiple text inputs with the same ID, which is easy to do with MVC frameworks when you have multiple editors on page for same model class. I resolved it by explicitly specifying Id and leaving Name as is, so that model resolving works on postback.
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