1.0.1 • Published 7 years ago
uc-calendar v1.0.1
Unchained UI
Calendar UI Component
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,
0for Sunday or1for 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,monthsoryears, defaultdays. 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