Skip to content

jiandaoyun/Perfect-DateTimePicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Perfect-DateTimePicker


A jQuery plugin for Date and Time Picker(基于jQuery的日期时间选择器)

Demo: http://jiandaoyun.github.io/Perfect-DateTimePicker/

Features(特性)

  1. Simple Interaction.(交互简单)
  2. Concise Interface.(界面整洁)
  3. Bootstrap Style.(类Bootstrap风格)

Preview(预览图)

API(接口)

  • options(属性配置)
property(属性)type(类型)description(描述)
baseClsStringbase class(主样式)
languageString'zh'|'en'
viewModeString'YM'|'YMD'|'YMDHMS'|'HMS'
startDateDatestart date(起始日期)
endDateDateend date(结束日期)
dateDateinitial date(初始值)
firstDayOfWeekNumberthe first Day Of Week,0~6:Sunday~Saturday,default:0(指定每周的第一天,默认周日)
onDateChangeFunctiondate change event(日期修改事件)
onClearFunctionclear button click event(清除按钮事件)
onOkFunctionok button click event(确认按钮事件)
onCloseFunctionclose button click event(关闭按钮事件)
  • APIs(调用接口)
function(方法)type(类型)parameters(参数)description(描述)
getValueFunction获取当前日期对象
getTextFunctionformat(可选,日期格式,例如: 'YYYY-MM-DD HH:mm:ss')获取当前日期的文本格式
destroyFunction销毁对象
elementObject返回选择器的jQuery对象
$datetableObject返回日期选择面板的jQuery对象
$monthtableObject返回年月选择面板的jQuery对象
$timetableObject返回时间选择面板的jQuery对象

Example(代码示例)

    var picker = $('#demo1').datetimepicker({
        date: new Date(),
        viewMode: 'YMDHMS',
        firstDayOfWeek: 0,
        onDateChange: function(){
            $('#date-text').text(this.getText());
        },
        onClose: function(){
            this.element.remove();
        }
    });
    console.log(picker.getText());
    console.log(picker.getValue());
    picker.element.hide();

Compatible(浏览器兼容性)

IE8+

License(协议)

MIT license