views:

77

answers:

0

Hi All,

is there any jquery datepicker plugin to display as Buddhist date?

currently I use jquery ui datepicker to display it, but it's not actually I want. here is the code

$(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));
        }
    });
});

what I want is when #datepicker has no value, the calendar pop up is displaying current date + 543 years. when #datepicker has value, the calendar pop up is displaying the date in #datepicker value.

the problem is when selected year is a leap year, i.e. 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

thank you

Update 2010-07-30

according to this link http://dev.jqueryui.com/ticket/4843 and http://dev.jqueryui.com/ticket/5789 it seems they plan to create support for non gregorian calendar currently I try to use this plugins http://keith-wood.name/calendars.html