日期插件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, ''));/*获取选中的日期,清除中间的横杠,清除日期间的空格*/
});

 




转载于:https://www.cnblogs.com/laq627/p/6738461.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值