【问题标题】:How to update datepicker Year to Buddhist era如何将日期选择器年份更新为佛教时代
【发布时间】:2015-07-13 04:16:20
【问题描述】:

试图从日期选择器框架更改年份佛教时代+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请帮帮我

【问题讨论】:

    标签: jquery datepicker


    【解决方案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>
    

    【讨论】:

    • calendarpicker 不能与我的网站一起使用,因为我使用的是 jquery 2.0.2 版,但 calendarpicker 使用的是 1.11,但 datepicker 可以使用 jquery 2.0.2
    • 在 keith-wood datepicker 中使用泰历怎么样?
    • 我下载了 keith-wood 日期选择器和日历选择器。他们都使用 jQuery 1.11
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-21
    • 1970-01-01
    • 2020-02-07
    相关资源
    最近更新 更多