Constructor
new mw.widgets.datetime.CalendarWidget(configopt)
#
A widget for selecting a date from a calendar.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
<optional> |
Configuration options Properties
|
- Mixes In:
- Source:
Extends
Methods
adjustDate(date, component, delta, enforceRangeopt) → {Date}protected
#
Adjust a date.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
date |
Date | Date to adjust |
||
component |
string | Component: 'month', 'week', or 'day' |
||
delta |
number | Integer, usually -1 or 1 |
||
enforceRange |
boolean |
<optional> |
true | Whether to enforce this.min and this.max |
Returns:
- Type
- Date
getFocusedDate() → {Date}
#
Return the currently-focused date.
Returns:
- Type
- Date
onDayClick(button)protected
#
onDocumentMouseDown(e)protected
#
Handles document mouse down events.
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Mouse down event |
onKeyDown(e) → {boolean}protected
#
Handles key presses.
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key down event |
Returns:
False to cancel the default event
- Type
- boolean
onLocalChange()protected
#
Handles formatter 'local' flag changing.
onNextClick()protected
#
Handles next button click.
onPrevClick()protected
#
Handles previous button click.
setFocusedDate(date) → {mw.widgets.datetime.CalendarWidget}
#
Set the currently-focused date.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date |
Fires:
Returns:
setSelected(dates) → {mw.widgets.datetime.CalendarWidget}
#
Set the selected dates.
Parameters:
Name | Type | Description |
---|---|---|
dates |
Date
|
Array.<Date>
|
null
|
Fires:
Returns:
toggle()
#
updateUI()protected
#
Update the user interface.
Events
change(dates)
#
A change
event is emitted when the selected dates change.
Parameters:
Name | Type | Description |
---|---|---|
dates |
Date
|
Array.<Date>
|
null
|
The new date(s) or null |
change
event is emitted when the selected dates change.
focusChanged(date)
#
A focusChanged
event is emitted when the focused date changes.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | The newly focused date |
focusChanged
event is emitted when the focused date changes.
page(date)
#
A page
event is emitted when the current "month" changes.
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | The new date |
page
event is emitted when the current "month" changes.