如何更新datepicker年到佛教时代

时间:2015-07-13 04:16:21

标签: jquery datepicker

试图从datepicker框架改变一年佛教时代+543,但它没有工作。

我使用此框架代码此链接http://keith-wood.name/datepick.HTML 我阅读文档日期功能并尝试使用此代码,但没有再次工作:(

$('.picker').change(periods); 

function periods() { 
    var date = new Date($('.picker').datepick('getDate')[0].getTime()); 
    $.datepick.add(date, parseInt(543), 'y'); 
    $('.picker').val($.datepick.formatDate(date)); 
}

如何年份+543请帮助我

2 个答案:

答案 0 :(得分:2)

我已经为佛教时代定制了日期选择器,请从下面的链接中下载代码并使用它。

http://wikisend.com/download/519978/datepicker_buddhist.zip

谢谢,

答案 1 :(得分:1)

我认为您收到错误,因为您在当前日期添加543年设置的年份在日历中不可用。 请发布您的完整代码以便检查。 首先尝试将日历模式更改为泰语。

因为泰国日历与佛教日历相同 https://en.wikipedia.org/wiki/Thai_solar_calendar

注意:此日历选项在日期选择器中不可用,因此您需要使用日历控件。

http://keith-wood.name/calendars.html

以下是样本

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>jQuery Calendars Datepicker</title>
<link rel="stylesheet" href="jquery.calendars.picker.css">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="jquery.plugin.js"></script>
<!--<script src="jquery.calendars.all.js"></script><!-- Use instead of calendars, plus, and picker below -->
<script src="jquery.calendars.js"></script>
<script src="jquery.calendars.plus.js"></script>
<script src="jquery.calendars.picker.js"></script>
<!--<script src="jquery.calendars.picker.ext.js"></script><!-- Include for ThemeRoller styling -->
<script src="jquery.calendars.thai.js"></script>
<script>
$(function() {
//  $.calendars.picker.setDefaults({renderer: $.calendars.picker.themeRollerRenderer}); // Requires jquery.calendars.picker.ext.js
    var calendar = $.calendars.instance('thai');
    $('#inlineDatepicker').calendarsPicker({calendar: calendar, onSelect: showDate});
});

function showDate(date) {
    alert('The date chosen is ' + date);
}
</script>
</head>
<body>

<div id="inlineDatepicker"></div>
</body>
</html>