可定制的JS期与时间选择器:Rome
jopen
10年前
Rome是一个可定制的JS日期与时间选择器。不依赖于第三方库。
创建 Rome 日历有一堆的选项可以用。这些选项具有合理的默认值,很容易调整。这些选项在下面列出。
Option | Description |
---|---|
appendTo | DOM element where the calendar will be appended to. Takes 'parent' as the parent element |
autoClose | Closes the calendar when picking a day or a time |
autoHideOnBlur | Hides the calendar when focusing something other than the input field |
autoHideOnClick | Hides the calendar when clicking away |
date | The calendar shows days and allows you to navigate between months |
dateValidator | Function to validate that a given date is considered valid. Receives a native Date parameter. |
dayFormat | Format string used to display days on the calendar |
initialValue | Value used to initialize calendar. Takes string , Date , or moment |
inputFormat | Format string used for the input field as well as the results of rome |
invalidate | Ensures the date is valid when the field is blurred |
max | Disallow dates past max . Takes string , Date , or moment |
min | Disallow dates before min . Takes string , Date , or moment |
monthFormat | Format string used by the calendar to display months and their year |
required | Is the field required or do you allow empty values? |
styles | CSS classes applied to elements on the calendar |
time | The calendar shows the current time and allows you to change it using a dropdown |
timeFormat | Format string used to display the time on the calendar |
timeInterval | Seconds between each option in the time dropdown |
timeValidator | Function to validate that a given time is considered valid. Receives a native Date parameter. |
weekStart | Day considered the first of the week. Range: Sunday 0 - Saturday 6 |
在线演示:https://bevacqua.github.io/rome