Merge "rdbms: make transaction rounds apply DBO_TRX to DB_REPLICA connections"
[mediawiki.git] / resources / src / mediawiki.special.apisandbox / DateTimeParamWidget.js
blobd5aaff9d0673e02331c96386ceff1c6d61ddb80f
1 const TextParamMixin = require( './TextParamMixin.js' ),
2         UtilMixin = require( './UtilMixin.js' );
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;
18         DateTimeParamWidget.super.call( this, config );
21 OO.inheritClass( DateTimeParamWidget, mw.widgets.datetime.DateTimeInputWidget );
22 OO.mixinClass( DateTimeParamWidget, TextParamMixin );
23 OO.mixinClass( DateTimeParamWidget, UtilMixin );
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         }
36 module.exports = DateTimeParamWidget;