是否有任何 jQuery datepicker 插件可以显示为佛教日期?
目前我使用jQuery UI datepicker 来显示它,但它实际上并不是我想要的。这是代码:
$(document).ready( function() {
$("#datepicker").datepicker( {
appendText: ' yyyy-mm-dd',
autoSize: true,
buttonImage: 'images/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd',
showOtherMonths: true,
selectOtherMonths: true,
showOn: 'both',
onSelect: function(dateText, inst) {
year = dateText.substring(0, 4);
month = dateText.substring(5, 7);
day = dateText.substring(8);
_year = parseInt(year) + 543 + '';
$(this).val(_year + '-' + month + '-' + day);
},
beforeShow: function(input, inst) {
year = input.value.substring(0, 4);
month = input.value.substring(5, 7);
day = input.value.substring(8);
_year = parseInt(year) - 543 + '';
$(this).datepicker("setDate", new Date(_year, month - 1, day, 0, 0, 0, 0));
}
});
});
我想要的是当#datepicker
没有价值时,日历弹出显示当前日期+ 543年。当#datepicker
有一个值时,日历弹出显示#datepicker
值中的日期。
The problem is when the selected year is a leap year, for example, 2008-02-29 AD is valid but we can't display 2551-02-29 (Buddhist date) (which is the same date) on that pop up.
2010-07-30 更新
根据Add support for Thai year format in datepicker 模块和Datepicker: Support non-Gregorian calendars,看来他们计划创建对非公历的支持。