ch.Calendar
Description
It lets you move across the months of the year and allow to set dates as selected.
How-to
Parameters
-
el
- HTMLElement : A HTMLElement to create an instance of ch.Calendar. -
options
- Object : Options to customize an instance.-
format
- String : Sets the date format. You must use "DD/MM/YYYY", "MM/DD/YYYY" or "YYYY/MM/DD". Default: "DD/MM/YYYY". -
selected
- String : Sets a date that should be selected by default. Default: The date of today. -
from
- String : Set a minimum selectable date. The format of the given date should be YYYY/MM/DD. -
to
- String : Set a maximum selectable date. The format of the given date should be YYYY/MM/DD. -
monthsNames
- Array : A collection of months names. Default: ["Enero", ... , "Diciembre"]. -
weekdays
- Array : A collection of weekdays. Default: ["Dom", ... , "Sab"].
-
Extends
Properties
._next
HTMLDivElement
Template of next arrow.
._prev
HTMLDivElement
Template of previous arrow.
.Calendar#name
String
The name of the component.
.Component#name
String
The name of a component.
.container
HTMLElement
The calendar container.
.uid
Number
A unique id to identify the instance of a component.
Methods
-
date
- String : A given date to select. The format of the given date should be "YYYY/MM/DD". -
date
- String : A given date to set as minimum selectable date. The format of the given date should be "YYYY/MM/DD". -
date
- String : A given date to set as maximum selectable date. The format of the given date should be "YYYY/MM/DD".
.constructor()
Returns a reference to the constructor function.
.destroy()
Destroys a Calendar instance.
.getToday() → {String}
Returns date of today
.nextMonth() → {calendar}
Moves to the next month.
.nextYear() → {calendar}
Move to the next year.
.prevMonth() → {calendar}
Move to the previous month.
.prevYear() → {calendar}
Move to the previous year.
.select(date) → {calendar}
Selects a specific date or returns the selected date.
.setFrom(date) → {calendar}
Set a minimum selectable date.
.setTo(date) → {calendar}
Set a maximum selectable date.
.constructor()
Returns a reference to the constructor function.
.destroy()
Destroys an instance of Component and remove its data from asociated element.
.disable() → {component}
Disables an instance of Component.
.enable() → {component}
Enables an instance of Component.
.require() → {component}
Adds functionality or abilities from other classes.
Events
'destroy'
Emits when a component is destroyed.
'disable'
Emits when a component is disable.
'enable'
Emits when a component is enabled.
'nextmonth'
Event emitted when a next month is shown.
'nextyear'
Event emitted when a next year is shown.
'prevmonth'
Event emitted when a previous month is shown.
'prevyear'
Event emitted when a previous year is shown.
'ready'
Event emitted when the component is ready to use.
'select'
Event emitted when a date is selected.