jquery - 如何将日期选择器年份更新为佛教时代

标签 jquery 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 请帮助我

最佳答案

我认为您收到错误,因为您通过为当前日期添加 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>

关于jquery - 如何将日期选择器年份更新为佛教时代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31375328/

相关文章:

javascript - 如果没有页面刷新,单击功能不会触发

javascript - 为什么我必须使用 $(this)?

Jquery 在图像之间切换

java - android中的日期选择器显示问题

android - Material 设计日期选择器 : How to popup datepicker when click on a Spinner

javascript - jquery datepicker - 如何使只读和必需?

javascript - 将 Page.IsValid 设置为 False

javascript - 设置日期选择器的值后,它搞砸了

javascript - jQuery,如何传递 rgb 值来更改 css 背景?

javascript - 查找因溢出而被隐藏的文本 :hidden?