Cakephp 3.x - datetime input as text for datetimepicker
<p>This has been bugging me for a while now.
I would like to use a Javascript datetimepicker, instead of the default set of select boxes that the CakePHP Formhelper generates.
The easy solution would seem to be:</p>

<pre><code>echo $this-&gt;Form-&gt;input('start_time', ['type' =&gt; 'text', 'class'=&gt;'datetime']);
</code></pre>

<p>But this introduces some other problems as Cake will then convert the values into the locale format. I would also prefer a solution that worked from a general perspective, so I looked into changing the template for the datetime input:</p>

<pre><code>//AppView.php
class AppView extends View
{
public function initialize()
{
    $this-&gt;Form-&gt;templates(['dateWidget' =&gt; '&lt;input type="text" class="datetime" name="{{name}}"{{attrs}}/&gt;']); 
}
</code></pre>

<p>}</p>

<p>This, however is as close as I've gotten. What happens is that the Formhelper outputs a nice text input, with an empty name attribute, which defeats the purpose.</p>

<p>I assume this is because the datetimeinput is basically wired to output the select fields, and is thus confused by my approach here.</p>

<p>But what would be the right way to do it?</p>