Skip to content

jumodada/date-picker

Repository files navigation

flex-date-picker

A datepicker for PC(尚未完成功能和单元测试,请勿用于开发)

build status

Doc

https://jumodada.github.io/date-picker/#/

Installing

Using npm:

$ npm install flex-date-picker

Using yarn:

$ yarn add flex-date-picker

Usage

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

About

轻量好用的日期选择器

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published