Getting started

It takes just 3 easy steps to integrate When.datepicker plugin with your website:

  1. Copy the dist folder to your working directory.

  2. Include JavaScript and CSS files in the <head> and <body> of your HTML page:

    <head>
        ...
        <link rel='stylesheet' type='text/css' href='dist/css/when.min.css'>
    </head>
    <body>
        ...
        <script type="text/javascript" src="dist/when.min.js"></script>
    </body>
    
  3. To attach a When.datepicker object to an element you desire, use this:

    new When({
        input: document.getElementById('picker-input')
    });
    

    You can customize your plugin with options you provide to the constructor function:

    let whenInstance = new When({
        container: document.getElementById('picker-container'),
        keyboardEvents: true,
        inline: true,
        locale: 'en',
        //etc...
    });
    

Development server

To start the development server, run the following commands:

npm i
npm run start

Setting a date

Any date in When.datepicker configuration can be specified:

Configuration

Events

Methods

Changelog