Question about dumping jquery with format

When I enter the line 01/01/24 in the input field, it returns the date 01/01/2024 , but if I 01/01/25 , it will return the date 01/01/1925 .

Is it possible to prevent this event and always return the date after the year 2000 ?

The user does not want me to change the dateFormat with dd/mm/yy , so I am stuck in the dd/mm/y format.

Here is the js I use to create the datepicker:

 $('.hasDatepicker').datepicker({ showOn: "button", buttonImage: imagePrefix + "/img/calendar_1.png", buttonImageOnly: true, dateFormat: "dd/mm/y", yearRange: "2000:2099", onSelect: function(e, d) { $(this).trigger("change"); } }); 
+7
jquery date datepicker
source share
1 answer

This is because the shortYearCutoff option:

The clipping year to determine the century for the date (used in conjunction with dateFormat 'y'). Any dates entered with an annual value less than or equal to the cut-off period are considered to be located while those that are larger than them are considered to be in the previous century.

the default value is +10, you can increase it to the main value, for example, +50.

Demo: http://jsfiddle.net/IrvinDominin/5Db32/

+4
source share

All Articles