1

先上图片(看效果)
clipboard.png
clipboard.png

今天遇到一个需求,需要选择日期的时候 时分秒都要为00:00:00
$(".form_datetime").datetimepicker({format: 'yyyy-mm-dd 00:00:00 ',minView:2,language:'zh-CN'});
当时这种写法并不好用
自己改了一下插件(实现效果如下)
$(".form_datetime").datetimepicker({format: 'yyyy-mm-dd 00:00:ll',minView:2,language:'zh-CN'});

需要支持中文的需要修改 $.fn.datetimepicker.Constructor = Datetimepicker; 需要改成下面的效果。
$.fn.datetimepicker.Constructor = Datetimepicker;

var dates = $.fn.datetimepicker.dates = {
    en: {
        days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
        daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
        months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
        monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
        meridiem: ["am", "pm"],
        suffix: ["st", "nd", "rd", "th"],
        today: "Today"
    },
    'zh-CN':{
        days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
        daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
        daysMin:  ["日", "一", "二", "三", "四", "五", "六", "日"],
        months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        today: "今日",
        suffix: [],
        meridiem: []
    }
};

需要下载地址:
https://github.com/308626712/...


brandon
4 声望2 粉丝

php后端工程师


下一篇 »
git 快速入门