mw.widgets.datetime.DateTimeInputWidget(configopt)

DateTimeInputWidgets can be used to input a date, a time, or a date and time, in either UTC or the user's local timezone. Please see the OOUI documentation on MediaWiki for more information and examples.

This widget can be used inside a HTML form, such as a OO.ui.FormLayout.

Example

// Example of a text input widget
var dateTimeInput = new mw.widgets.datetime.DateTimeInputWidget( {} )
$( document.body ).append( dateTimeInput.$element );

Constructor

new mw.widgets.datetime.DateTimeInputWidget(configopt) #

A widget with a series of inputs for date and time.

Parameters:

Name Type Attributes Description
config Object <optional>

Configuration options

Properties
Name Type Attributes Default Description
type string <optional>
'datetime'

Whether to act like a 'date', 'time', or 'datetime' input. Affects values stored in the relevant <input> and the formatting and interpretation of values passed to/from getValue() and setValue(). It's up to the user to configure the DateTimeFormatter correctly.

formatter Object | mw.widgets.datetime.DateTimeFormatter <optional>
{}

Configuration options for mw.widgets.datetime.ProlepticGregorianDateTimeFormatter (with 'format' defaulting to '@date', '@time', or '@datetime' depending on 'type'), or an mw.widgets.datetime.DateTimeFormatter instance to use.

calendar Object | null <optional>
{}

Configuration options for mw.widgets.datetime.CalendarWidget; note certain settings will be forced based on the settings passed to this widget. Set null to disable the calendar.

required boolean <optional>
false

Whether a value is required.

clearable boolean <optional>
true

Whether to provide for blanking the value.

value Date | null <optional>
null

Default value for the widget

min Date | string | null <optional>
null

Minimum allowed date

max Date | string | null <optional>
null

Maximum allowed date

Mixes In:
Source:
A widget with a series of inputs for date and time.

Extends

Methods

getValueAsDate() → {Date|null} #

Get the value of the input as a Date object.

Source:

Returns:

Type
Date | null
Get the value of the input as a Date object.