Code Monkey home page Code Monkey logo

date-picker's Introduction

date picker

create a new Date Picker:

The constructor accepts a Date object and a callback function as arguments. The start date and the end date and whether it's done selecting is passed to the callback as params.

const datePicker = new DatePicker(Date, Callback)

const callback = (startDate, endDate, isDone)=>{/* do stuff */}

Set a specific month or year. Months are 0 index.

datePicker.setMonth(2)
datePick.setYear(2002)
datePicker.setDate(new Date())

Get the layout, returns the HTMLElement containing the date picker.

datePicker.getLayout()

Only allow selecting single dates by passing true to third param. Or calling setSingleSelect and pass true as value;

new DatePicker(Date, callback, true)
datePicker.setSingleSelect(true)

Reset the date picker to the current month and year by calling reset, or reset it to a specific date by passing a Date object to the params.

datePicker.reset()
datePicker.reset(newDate)

Use deSelect forget start and end date on the date picker.

datePicker.deSelect()

Picking a date

Click on a date on the picker to select it.

Click and drag across multiple boxes to select a range of dates.

Click on the month to select a specific month.

Click on the year to select a specific year. Scroll to the desired year or just type it in on the input.

To make a selection across multiple months, use context menu to select the first date and then use either normal click or context menu to select the second date.

Reset selection by clicking on one of the highlighted selected dates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.