Form-control ('date')

1

I'm having a problem with CakePHP 3 when creating a control of type date, and that it has the format of entry D M Y. Since now I have left Y M D H i.

As far as I can see, the 'dateFormat' option does not work. If you know how to solve this problem, I would appreciate it!

echo $this->Form->control('fecha_nacimiento', ['label' => 'Fecha de nacimiento', 'empty' => false, ' dateFormat' => 'DMY','separator' =>
                    null, 'error' => false, 'minYear' => date('Y') - 70, 'maxYear' => date('Y') - 5 ]);
    
asked by Nico 24.08.2017 в 15:40
source

1 answer

0

This is the way to solve the problem!

<?php
    $this->Form->templates(['dateWidget' => '{{day}}{{month}}{{year}}']);

    echo $this->Form->control('fecha_nacimiento', ['label' => 'Fecha de nacimiento', 'empty' => false, 'type' => 'date' ,'dateFormat' => 'DMY', 'minYear' => date('Y') - 70, 'maxYear' => date('Y') - 5 ]);

?>
    
answered by 06.10.2017 / 20:38
source