uc-calendar

1.0.1 • Public • Published

Unchained UI

Calendar UI Component

NPM Version NPM Downloads

Usage

import Calendar from 'uc-calendar';
 
const elDisplay = get('#display');
 
const calendar = new Calendar({
  onChange: date => {
    console.log('date', date);
  }
}).appendTo(elDisplay);
 

This component follows Unchained UI guidelines.

Constructor options:

  • onChange — function, callback will be called when value is changed
  • locale – object, locale defenition, default is 'en-US'.
  • weekStarts — number, 0 for Sunday or 1 for Monday. Overides the locale settings.
  • flip – boolean, default false, renders the calendar with the header on the bottom.
  • value — integer, timestamp in milliseconds or string, representing a date in a format recognized by the Date.parse() method
  • mode — string, days, months or years, default days. The start display mode.
  • forward - string, html string to add to the forward button.
  • back - string, html string to add to the back button.

Methods

value([val])

If val is undefined returns current value as a Date instance, otherwise sets the value.

forward()

Change the calendar page forward

back()

Change the calendar page back

setMode([mode])

Sets the mode. If mode is undefined sets the next mode.

toString()

Returns the string representation of the selected date according to locale.

remove()

Removes the component.

License MIT

© velocityzen

Package Sidebar

Install

npm i uc-calendar

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

34.9 kB

Total Files

15

Last publish

Collaborators

  • velocityzen