Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery ui datepicker back button jumps to 1899

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);
    }
   });
like image 508
prl Avatar asked Sep 30 '10 13:09

prl


People also ask

How can change date format in jQuery ui Datepicker?

inside the jQuery script code just paste the code. $( ". selector" ). datepicker({ dateFormat: 'yy-mm-dd' });

How do I change date format in Datepicker?

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.

How do I change my Datepicker size?

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.


1 Answers

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.

like image 106
Boris B. Avatar answered Sep 28 '22 13:09

Boris B.