Debian Codegraph @

resources/src/mediawiki.special.apisandbox/DateTimeParamWidget.js

raw symbols SCIP
1 const TextParamMixin = require( './TextParamMixin.js' ),
2 UtilMixin = require( './UtilMixin.js' );
3
4 /**
5 * A wrapper for mw.widgets.datetime.DateTimeInputWidget
6 *
7 * @class
8 * @private
9 * @constructor
10 * @param {Object} config Configuration options
11 */
12 function DateTimeParamWidget( config ) {
13 config.formatter = {
14 format: '${year|0}-${month|0}-${day|0}T${hour|0}:${minute|0}:${second|0}${zone|short}'
15 };
16 config.clearable = false;
17
18 DateTimeParamWidget.super.call( this, config );
19 }
20
21 OO.inheritClass( DateTimeParamWidget, mw.widgets.datetime.DateTimeInputWidget );
22 OO.mixinClass( DateTimeParamWidget, TextParamMixin );
23 OO.mixinClass( DateTimeParamWidget, UtilMixin );
24
25 /**
26 * @return {jQuery.Promise}
27 */
28 DateTimeParamWidget.prototype.getValidity = function () {
29 if ( !this.apiBool( this.paramInfo.required ) || this.getApiValue() !== '' ) {
30 return $.Deferred().resolve().promise();
31 } else {
32 return $.Deferred().reject().promise();
33 }
34 };
35
36 module.exports = DateTimeParamWidget;