ch.Datepicker
Description
Datepicker lets you select dates.
How-to
Parameters
-
el
- HTMLElement : A HTMLElement to create an instance of ch.Datepicker. -
options
- Object : Options to customize an instance.-
format
- String : Sets the date format. Default: "DD/MM/YYYY". -
selected
- String : Sets a date that should be selected by default. Default: "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"]. -
hiddenby
- Boolean : Determines how to hide the component. You must use: "button", "pointers", "pointerleave", "all" or "none". Default: "pointers". -
context
- HTMLElement : It's a reference to position and size of element that will be considered to carry out the position. -
side
- String : The side option where the target element will be positioned. You must use: "left", "right", "top", "bottom" or "center". Default: "bottom". -
align
- String : The align options where the target element will be positioned. You must use: "left", "right", "top", "bottom" or "center". Default: "center". -
offsetX
- Number : Distance to displace the target horizontally. -
offsetY
- Number : Distance to displace the target vertically. -
position
- String : The type of positioning used. You must use: "absolute" or "fixed". Default: "absolute".
-
Extends
Properties
.Component#name
String
The name of a component.
.Datepicker#name
String
The name of the component.
.field
HTMLElement
The datepicker input field.
.trigger
HTMLElement
The datepicker trigger.
.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 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.
.constructor()
Returns a reference to the constructor function.
.destroy()
Destroys a Datepicker instance.
.getToday() → {String}
Returns date of today
.hide() → {datepicker}
Hides the datepicker.
.nextMonth() → {datepicker}
Moves to the next month.
.nextYear() → {datepicker}
Move to the next year.
.prevMonth() → {datepicker}
Move to the previous month.
.prevYear() → {datepicker}
Move to the previous year.
.reset() → {datepicker}
Reset the Datepicker to date of today
.select(date) → {datepicker|String}
Selects a specific date or returns the selected date.
.setFrom(date) → {datepicker}
Set a minimum selectable date.
.setTo(date) → {datepicker}
Set a maximum selectable date.
.show() → {datepicker}
Shows the datepicker.
Events
'destroy'
Emits when a component is destroyed.
'disable'
Emits when a component is disable.
'enable'
Emits when a component is enabled.
'hide'
Event emitted when a datepicker is hidden.
'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.
'reset'
Event emitter when the datepicker is reseted.
'select'
Event emitted when a date is selected.
'show'
Event emitted when a datepicker is shown.