Jquery datepicker issue with format
When I type in the input field the string 01/01/24
it returns the date 01/01/2024
but if I type 01/01/25
it returns the date 01/01/1925
.
Is it possible to prevent this event and always return a date after the year 2000
?
The user doesn't want me to change the dateFormat
by using dd/mm/yy
, so I'm stuck with the format dd/mm/y
.
Here is the js I use for creating 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");
}
});
It's because the option shortYearCutoff
:
The cutoff year for determining the century for a date (used in conjunction with dateFormat 'y'). Any dates entered with a year value less than or equal to the cutoff year are considered to be in the current century, while those greater than it are deemed to be in the previous century.
the default value is +10, you can enlarge it to a major value like +50.
Demo: http://jsfiddle.net/IrvinDominin/5Db32/
链接地址: http://www.djcxy.com/p/80838.html上一篇: 客户端服务器没有可变状态?