html4 form日期,bootstrap4日期时间选择器插件

这是一款bootstrap4日期时间选择器插件。该bootstrap4日期时间选择器插件提供大量配置参数,可以基于bootstrap4制作出简单实用的日期选择器效果。它的特点还有:

支持语言国际化和timezone。

支持日期选择模式和时间选择模式。

支持最大和最小日期选择。

可自定义触发日期选择器的图标。

支持禁用指定的日期。

支持年/星期预览模式。

支持某个星期中禁用某些天。

可自定义日期格式。

提供大量的配置参数和API接口。

使用方法

在页面中引入jquery和bootstrap4相关文件,以及moment.js和tempusdominus-bootstrap-4.min.js文件。

HTML结构

一个最基本的bootstrap4日期时间选择器的HTML结构如下。

初始化插件

在页面DOM元素加载完毕之后,通过datetimepicker方法来初始化该bootstrap4日期选择器插件。

$(function () {

$('#datetimepicker1').datetimepicker();

});

配置参数

该bootstrap4日期选择器插件的可用配置参数有:

$('#datetimepicker-demo').datetimepicker({

// requires moment-timezone.js

timeZone: '',

// date format

// http://momentjs.com/docs/#/displaying/format/

format: false,

dayViewHeaderFormat: 'MMMM YYYY',

extraFormats: false,

// step size

stepping: 1,

// min/max dates

minDate: false,

maxDate: false,

// uses current date/time

useCurrent: true,

// uses Bootstraps collapse to switch between date/time pickers

collapse: true,

// https://github.com/moment/moment/tree/develop/locale

locale: moment.locale(),

// default date

defaultDate: false,

// disabled dates

// array of [date, moment, string]

disabledDates: false,

// enabled dates

// array of [date, moment, string]

enabledDates: false,

// default icons

icons: {

time: 'fa fa-clock-o',

date: 'fa fa-calendar',

up: 'fa fa-arrow-up',

down: 'fa fa-arrow-down',

previous: 'fa fa-chevron-left',

next: 'fa fa-chevron-right',

today: 'fa fa-calendar-check-o',

clear: 'fa fa-delete',

close: 'fa fa-times'

},

// tooltip options

tooltips: {

today: 'Go to today',

clear: 'Clear selection',

close: 'Close the picker',

selectMonth: 'Select Month',

prevMonth: 'Previous Month',

nextMonth: 'Next Month',

selectYear: 'Select Year',

prevYear: 'Previous Year',

nextYear: 'Next Year',

selectDecade: 'Select Decade',

prevDecade: 'Previous Decade',

nextDecade: 'Next Decade',

prevCentury: 'Previous Century',

nextCentury: 'Next Century',

pickHour: 'Pick Hour',

incrementHour: 'Increment Hour',

decrementHour: 'Decrement Hour',

pickMinute: 'Pick Minute',

incrementMinute: 'Increment Minute',

decrementMinute: 'Decrement Minute',

pickSecond: 'Pick Second',

incrementSecond: 'Increment Second',

decrementSecond: 'Decrement Second',

togglePeriod: 'Toggle Period',

selectTime: 'Select Time',

selectDate: 'Select Date'

},

// uses strict

useStrict: false,

// displays side by side

sideBySide: false,

// disabled days of the week

daysOfWeekDisabled: false,

// shows the week of the year

calendarWeeks: false,

// 'decades','years','months','days'

viewMode: 'days',

// toolbar placement

toolbarPlacement: 'default',

// enable/disable buttons

buttons: {

showToday: false,

showClear: false,

showClose: false

},

// widget position

widgetPositioning: {

horizontal: 'auto',

vertical: 'auto'

},

// string or jQuery object

widgetParent: null,

// ignore read only input

ignoreReadonly: false,

// always keep open

keepOpen: false,

// shows on focus

focusOnShow: true,

// inline mode

inline: false,

// makes the date picker not revert or overwrite invalid dates

keepInvalid: false,

// debug mode

debug: false,

// shows on focus and icon click

allowInputToggle: false,

// disables time selection

disabledTimeIntervals: false,

// disables/enables hours

disabledHours: false,

enabledHours: false,

// changes the viewDate without changing or setting the selected date

viewDate: false,

// allows multiple dates

allowMultidate: false,

// custom separator

multidateSeparator: ','

});

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值