65 $config = array_merge( [
68 'longDisplayFormat' =>
false,
72 if ( isset( $config[
'inputFormat'] ) ) {
73 $this->inputFormat = $config[
'inputFormat'];
75 if ( isset( $config[
'placeholderDateFormat'] ) ) {
76 $this->placeholderDateFormat = $config[
'placeholderDateFormat'];
78 $this->precision = $config[
'precision'];
79 if ( isset( $config[
'mustBeAfter'] ) ) {
80 $this->mustBeAfter = $config[
'mustBeAfter'];
81 } elseif ( isset( $config[
'min'] ) ) {
82 $this->mustBeAfter = $this->modifyDate( $config[
'min'],
'-1 day' );
84 if ( isset( $config[
'mustBeBefore'] ) ) {
85 $this->mustBeBefore = $config[
'mustBeBefore'];
86 } elseif ( isset( $config[
'max'] ) ) {
87 $this->mustBeBefore = $this->modifyDate( $config[
'max'],
'+1 day' );
91 if ( isset( $config[
'displayFormat'] ) ) {
92 $this->displayFormat = $config[
'displayFormat'];
94 if ( isset( $config[
'longDisplayFormat'] ) ) {
95 $this->longDisplayFormat = $config[
'longDisplayFormat'];
97 if ( isset( $config[
'placeholderLabel'] ) ) {
98 $this->placeholderLabel = $config[
'placeholderLabel'];
102 if ( $this->placeholderDateFormat !==
null ) {
104 } elseif ( $this->inputFormat !==
null ) {
108 $placeholder =
wfMessage(
"mw-widgets-dateinput-placeholder-$this->precision" )->text();
111 $config = array_merge( [
113 'placeholder' => $placeholder,
116 parent::__construct( $config );
120 if ( $this->mustBeAfter !==
null ) {
121 $this->input->setAttributes( [
'min' => $this->modifyDate( $this->mustBeAfter,
'+1 day' ) ] );
123 if ( $this->mustBeBefore !==
null ) {
124 $this->input->setAttributes( [
'max' => $this->modifyDate( $this->mustBeBefore,
'-1 day' ) ] );
128 $this->addClasses( [
'mw-widget-dateInputWidget' ] );