A datepicker for PC(尚未完成功能和单元测试,请勿用于开发)
https://jumodada.github.io/date-picker/#/
Using npm:
$ npm install flex-date-picker
Using yarn:
$ yarn add flex-date-picker
es6
import datePicker from 'flex-date-picker'
import 'flex-date-picker/dist/index.css'
CommonJS
const datePicker = require('flex-date-picker').default
require('flex-date-picker/dist/index.css')
<input type="text" id="input">
datePicker(document.querySelector('#input'),{
type:'date'
// options...
})
Options | Description | Type | Accepted Values | Default |
---|---|---|---|---|
type | type of datepicker | string | date/date-range | date |
format | Output format | string | - | yyyy/mm/dd |
placement | datepicker placement | string | top/bottom/right/left | bottom |
disabled | prohibited dates | function | - | - |
- disabled
datePicker(document.querySelector('#input'),{
type:'date',
disabled:(date)=>{
return date && date.valueOf() < Date.now()
}
})
name | Description |
---|---|
unbind | unbind |
getDate | Get the currently selected date |
getYear | Get the currently selected year |
getMonth | Get the currently selected month |
name | Description |
---|---|
change | Event triggered when the date changes |