* Defaults to the current date and time (with 0 milliseconds).
*/
mw.widgets.datetime.DateTimeFormatter = function MwWidgetsDatetimeDateTimeFormatter( config ) {
- var statick = this.constructor[ 'static' ];
-
- statick.setupDefaults();
+ this.constructor.static.setupDefaults();
config = $.extend( {
format: '@default',
local: false,
- fullZones: statick.fullZones,
- shortZones: statick.shortZones
+ fullZones: this.constructor.static.fullZones,
+ shortZones: this.constructor.static.shortZones
}, config );
// Mixin constructors
OO.EventEmitter.call( this );
// Properties
- if ( statick.formats[ config.format ] ) {
- this.format = statick.formats[ config.format ];
+ if ( this.constructor.static.formats[ config.format ] ) {
+ this.format = this.constructor.static.formats[ config.format ];
} else {
this.format = config.format;
}
* @inheritable
* @property {Object}
*/
- mw.widgets.datetime.DateTimeFormatter[ 'static' ].formats = {};
+ mw.widgets.datetime.DateTimeFormatter.static.formats = {};
/**
* Default time zone indicators
* @inheritable
* @property {string[]}
*/
- mw.widgets.datetime.DateTimeFormatter[ 'static' ].fullZones = null;
+ mw.widgets.datetime.DateTimeFormatter.static.fullZones = null;
/**
* Default abbreviated time zone indicators
* @inheritable
* @property {string[]}
*/
- mw.widgets.datetime.DateTimeFormatter[ 'static' ].shortZones = null;
+ mw.widgets.datetime.DateTimeFormatter.static.shortZones = null;
- mw.widgets.datetime.DateTimeFormatter[ 'static' ].setupDefaults = function () {
+ mw.widgets.datetime.DateTimeFormatter.static.setupDefaults = function () {
if ( !this.fullZones ) {
this.fullZones = [
mw.msg( 'timezone-utc' ),
return this.local;
};
+ // eslint-disable-next-line valid-jsdoc
/**
* Toggle whether dates are in local time or UTC
*
* - 'boolean': The field is a boolean.
* - 'toggleLocal': The field represents {@link #getLocal this.getLocal()}.
* Editing should directly call {@link #toggleLocal this.toggleLocal()}.
+ * @return {boolean} return.calendarComponent Whether this field is part of a calendar, e.g.
+ * part of the date instead of the time.
* @return {number} return.size Maximum number of characters in the field (when
* the 'intercalary' component is falsey). If 0, the field should be hidden entirely.
* @return {Object.<string,number>} return.intercalarySize Map from
}
spec = {
component: null,
+ calendarComponent: false,
editable: false,
type: 'static',
value: params.slice( 1 ).join( '|' ),
c = params[ 0 ] === '#' ? '' : ':';
return {
component: 'zone',
+ calendarComponent: false,
editable: true,
type: 'toggleLocal',
size: 5 + c.length,
case 'full':
spec = {
component: 'zone',
+ calendarComponent: false,
editable: true,
type: 'toggleLocal',
values: params[ 0 ] === 'short' ? this.shortZones : this.fullZones,
* - 'clip': "Jan 32" => "Jan 31", "Feb 32" => "Feb 28" (or 29), "Feb 0" => "Feb 1", etc.
* @return {Date} Adjusted date
*/
- mw.widgets.datetime.DateTimeFormatter.prototype.adjustComponent = function ( date /*, component, delta, mode */ ) {
+ mw.widgets.datetime.DateTimeFormatter.prototype.adjustComponent = function ( date /* , component, delta, mode */ ) {
// Should be overridden by subclass
return date;
};