0.3.1 • Published 4 years ago

js-calendarspicker v0.3.1

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

JS-CalendarsPicker

Demo Here

Installation

NPM

npm i js-calendarspicker

CDN

<script src="https://unpkg.com/js-calendarspicker"></script>

Usage

import JSCalendarsPicker from 'js-calendarspicker';

var elem = document.getElementById('calendar-input');

// create instance of a plugin
var instance = new JSCalendarsPicker(elem, {YOUR_OPTIONS_HERE});

// initialize
instance.init();

Options

format

You can use this option to customize the date format.

type: string default: 'DD/MM/YYYY'

supported tokens (case-sensitive):

InputExampleDescription
YYYY20194 digit year
YY192 digit year
M1..12month number
MM01..122 digit month number
MMMJanshort month name
MMMMJanuaryfull month name
D1..31day number
DD01..312 digit day number

example:

new JSCalendarsPicker(elem, {
  format: 'DD-MM-YYYY'
});

defaultDate

You can use this option to init your calendar with default date

type: Date Object default: null

example:

new JSCalendarsPicker(elem, {
  defaultDate: new Date(2020, 8, 20)
});

Callback Events

onSelect

this event fired on day selection, returns the Date Object of the selected day

Usage:

new JSCalendarsPicker(elem, {
  onSelect: function(dateObject){
    alert(dateObject); // the selected day date object
  }
});
0.3.1

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago