protected $inputFormat = null;
protected $displayFormat = null;
+ protected $longDisplayFormat = null;
protected $placeholderLabel = null;
protected $placeholderDateFormat = null;
protected $precision = null;
* while the widget is inactive. Should be as unambiguous as possible (for example, prefer
* to spell out the month, rather than rely on the order), even if that makes it longer.
* Applicable only if the widget is infused. (default: language-specific)
+ * @param string $config['longDisplayFormat'] If a custom displayFormat is not specified, use
+ * unabbreviated day of the week and month names in the default language-specific
+ * displayFormat. (default: false)
* @param string $config['placeholderLabel'] Placeholder text shown when the widget is not
* selected. Applicable only if the widget is infused. (default: taken from message
* `mw-widgets-dateinput-no-date`)
$config = array_merge( [
// Default config values
'precision' => 'day',
+ 'longDisplayFormat' => false,
], $config );
// Properties
if ( isset( $config['displayFormat'] ) ) {
$this->displayFormat = $config['displayFormat'];
}
+ if ( isset( $config['longDisplayFormat'] ) ) {
+ $this->longDisplayFormat = $config['longDisplayFormat'];
+ }
if ( isset( $config['placeholderLabel'] ) ) {
$this->placeholderLabel = $config['placeholderLabel'];
}
if ( $this->displayFormat !== null ) {
$config['displayFormat'] = $this->displayFormat;
}
+ if ( $this->longDisplayFormat !== null ) {
+ $config['longDisplayFormat'] = $this->longDisplayFormat;
+ }
if ( $this->placeholderLabel !== null ) {
$config['placeholderLabel'] = $this->placeholderLabel;
}
* while the widget is inactive. Should be as unambiguous as possible (for example, prefer to
* spell out the month, rather than rely on the order), even if that makes it longer. When not
* given, the default is language-specific.
+ * @cfg {boolean} [longDisplayFormat=false] If a custom displayFormat is not specified, use
+ * unabbreviated day of the week and month names in the default language-specific displayFormat.
* @cfg {string} [placeholderLabel=No date selected] Placeholder text shown when the widget is not
* selected. Default text taken from message `mw-widgets-dateinput-no-date`.
* @cfg {string} [placeholderDateFormat] User-visible date format string displayed in the textual input
// Config initialization
config = $.extend( {
precision: 'day',
+ longDisplayFormat: false,
required: false,
placeholderLabel: mw.msg( 'mw-widgets-dateinput-no-date' )
}, config );
this.inTextInput = 0;
this.inputFormat = config.inputFormat;
this.displayFormat = config.displayFormat;
+ this.longDisplayFormat = config.longDisplayFormat;
this.required = config.required;
this.placeholderLabel = config.placeholderLabel;
ll = localeData.longDateFormat( 'll' );
format = llll.replace( lll.replace( ll, '' ), '' );
+ if ( this.longDisplayFormat ) {
+ format = format.replace( 'MMM', 'MMMM' ).replace( 'ddd', 'dddd' );
+ }
+
return format;
}
};