|
@@ 109-114 (lines=6) @@
|
| 106 |
|
|
| 107 |
|
// Calculate min/max attributes (which are skipped by TextInputWidget) and add to <input> |
| 108 |
|
// min/max attributes are inclusive, but mustBeAfter/Before are exclusive |
| 109 |
|
if ( $this->mustBeAfter !== null ) { |
| 110 |
|
$min = new DateTime( $this->mustBeAfter ); |
| 111 |
|
$min = $min->modify( '+1 day' ); |
| 112 |
|
$min = $min->format( 'Y-m-d' ); |
| 113 |
|
$this->input->setAttributes( [ 'min' => $min ] ); |
| 114 |
|
} |
| 115 |
|
if ( $this->mustBeBefore !== null ) { |
| 116 |
|
$max = new DateTime( $this->mustBeBefore ); |
| 117 |
|
$max = $max->modify( '-1 day' ); |
|
@@ 115-120 (lines=6) @@
|
| 112 |
|
$min = $min->format( 'Y-m-d' ); |
| 113 |
|
$this->input->setAttributes( [ 'min' => $min ] ); |
| 114 |
|
} |
| 115 |
|
if ( $this->mustBeBefore !== null ) { |
| 116 |
|
$max = new DateTime( $this->mustBeBefore ); |
| 117 |
|
$max = $max->modify( '-1 day' ); |
| 118 |
|
$max = $max->format( 'Y-m-d' ); |
| 119 |
|
$this->input->setAttributes( [ 'max' => $max ] ); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
// Initialization |
| 123 |
|
$this->addClasses( [ 'mw-widget-dateInputWidget' ] ); |