CakePHP3 Form control with type="date"


#1

Table Articles have a field date_expired with type date.
I after the standart code

echo $this->Form->control('date_expired');

A want this:
Снимок экрана_2017-09-28_15-50-00

<div class="input date">
  <label>Date Expired</label>
  <input type="date" value="2017-09-28" name="date_expired">
</div>

But CakePHP3 wrote
Снимок экрана_2017-09-28_15-48-52

<div class="input date"><label>Date Expired</label>
    <select name="date_expired[year]">
        <option value=""></option><option value="2022">2022</option><option value="2021">2021</option><option value="2020">2020</option><option value="2019">2019</option><option value="2018">2018</option><option value="2017" selected="selected">2017</option><option value="2016">2016</option><option value="2015">2015</option><option value="2014">2014</option><option value="2013">2013</option><option value="2012">2012</option>
    </select>
    <select name="date_expired[month]">
        <option value=""></option><option value="01">January</option><option value="02">February</option><option value="03">March</option><option value="04">April</option><option value="05">May</option><option value="06">June</option><option value="07">July</option><option value="08">August</option><option value="09" selected="selected">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option>
    </select>
    <select name="date_expired[day]">
        <option value=""></option><option value="01">1</option><option value="02">2</option><option value="03">3</option><option value="04">4</option><option value="05">5</option><option value="06" selected="selected">6</option><option value="07">7</option><option value="08">8</option><option value="09">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option>
    </select>
</div>

#2

I have solved this

  $control_html = 
        $this->Form->control(
          'date_expired', [
            'type' => 'text'
          ]);

  $date_control = 
    str_replace(
       'type="text"', 
       'type="date"', 
       $control_html
  );

And this returns html

<div class="input date">
  <label>Date Expired</label>
  <input type="date" value="2017-09-28" name="date_expired">
</div>