zoukankan      html  css  js  c++  java
  • 日期插件kalendae,遇到的一些问题

    1.日期中文显示

    /*_months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),*/
    _months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
    months : function (m) {
        return this._months[m.month()];
    },
    /*_monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),*/
    _monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
    monthsShort : function (m) {
        return this._monthsShort[m.month()];
    },
    _weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
    weekdays : function (m) {
        return this._weekdays[m.day()];
    },
    
    _weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
    weekdaysShort : function (m) {
        return this._weekdaysShort[m.day()];
    },
    
    _weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
    weekdaysMin : function (m) {
        return this._weekdaysMin[m.day()];
    },

    2.kalendae中的事件

    subscribe属性表示绑定kalendea指定的事件,支持的事件有change、date-clicked、view-changed
    <script type="text/javascript">
        new Kalendae(document.getElementById("date"), {
            months:1,
            mode:'multiple',
            subscribe: {
               'date-clicked': function (date) {
                   console.log(date._i, this.getSelected());
               },
               'change': function(){
                   console.log(date._i, this.getSelected());
               }
            }
        });
    </script>
    var kal = new Kalendae({
        attachTo: 'time',
        months:3,
        mode:'multiple'
    });
    
    $('.btn').click(function(){
        console.log(kal.getSelected());/*获取选中的日期*/
        console.log(kal.getSelected().format().replace(/s/g, ''));/*获取选中的日期,清除中间的横杠,清除日期间的空格*/
    });



  • 相关阅读:
    Lightoj 1023
    Tju 4119. HDFS
    Lightoj 1020
    Lightoj 1019
    小奇挖矿 2(4和7)
    [AHOI2012]树屋阶梯
    漂亮字串
    Prison 监狱
    2-XOR-SAT
    牛宫
  • 原文地址:https://www.cnblogs.com/laq627/p/6738461.html
Copyright © 2011-2022 走看看