1.3.1 • Published 5 years ago
null-picker v1.3.1
flex-date-picker
A datepicker for PC(尚未完成功能和单元测试,请勿用于开发)
Doc
https://jumodada.github.io/date-picker/#/
Installing
Using npm:
$ npm install flex-date-pickerUsing yarn:
$ yarn add flex-date-pickerUsage
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')Example
<input type="text" id="input"> datePicker(document.querySelector('#input'),{
type:'date'
// options...
})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 | - | - |
Options Example
- disabled
datePicker(document.querySelector('#input'),{
type:'date',
disabled:(date)=>{
return date && date.valueOf() < Date.now()
}
})Method
| name | Description |
|---|---|
| unbind | unbind |
| getDate | Get the currently selected date |
| getYear | Get the currently selected year |
| getMonth | Get the currently selected month |
Event
| name | Description |
|---|---|
| change | Event triggered when the date changes |
1.3.1
5 years ago