protected function buildDatetimepicker($input, array $options = [])
    {
        $this->Asset->script([
            '/vendor/moment/moment-with-locales.min',
            'MeTools.bootstrap-datetimepicker.min',
        ], ['block' => 'script_bottom']);

        $this->Asset->css(
            '/vendor/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min',
            ['block' => 'css_bottom']
        );

        $options = optionsParser($options, [
            'icons' => [
                'time' => 'fas fa-clock',
                'date' => 'fas fa-calendar',
                'up' => 'fas fa-chevron-up',
                'down' => 'fas fa-chevron-down',
                'previous' => 'fas fa-chevron-left',
                'next' => 'fas fa-chevron-right',
                'today' => 'fas fa-dot-circle',
                'clear' => 'fas fa-trash',
                'close' => 'fas fa-times',
            ],
            'locale' => substr(I18n::getLocale(), 0, 2) ?: 'en-gb',
            'showTodayButton' => true,
            'showClear' => true,
        ]);

        return sprintf('$("%s").datetimepicker(%s);', $input, json_encode($options->toArray(), JSON_PRETTY_PRINT));
    }
protected function buildDatetimepicker($input, array $options = [])
    {
        $this->Asset->script([
            '/vendor/moment/moment-with-locales.min',
            'MeTools.bootstrap-datetimepicker.min',
        ], ['block' => 'script_bottom']);

        $this->Asset->css(
            '/vendor/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min',
            ['block' => 'css_bottom']
        );

        $options = optionsParser($options, [
            'icons' => [
                'time' => 'fas fa-clock',
                'date' => 'fas fa-calendar',
                'up' => 'fas fa-chevron-up',
                'down' => 'fas fa-chevron-down',
                'previous' => 'fas fa-chevron-left',
                'next' => 'fas fa-chevron-right',
                'today' => 'fas fa-dot-circle',
                'clear' => 'fas fa-trash',
                'close' => 'fas fa-times',
            ],
            'locale' => substr(I18n::getLocale(), 0, 2) ?: 'en-gb',
            'showTodayButton' => true,
            'showClear' => true,
        ]);

        return sprintf('$("%s").datetimepicker(%s);', $input, json_encode($options->toArray(), JSON_PRETTY_PRINT));
    }
protected function buildDatetimepicker ( $ input , array $ options = [ ] ) { $ this -> Asset -> script ( [ '/vendor/moment/moment-with-locales.min' , 'MeTools.bootstrap-datetimepicker.min' , ] , [ 'block' => 'script_bottom' ] ) ; $ this -> Asset -> css ( '/vendor/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min' , [ 'block' => 'css_bottom' ] ) ; $ options = optionsParser ( $ options , [ 'icons' => [ 'time' => 'fas fa-clock' , 'date' => 'fas fa-calendar' , 'up' => 'fas fa-chevron-up' , 'down' => 'fas fa-chevron-down' , 'previous' => 'fas fa-chevron-left' , 'next' => 'fas fa-chevron-right' , 'today' => 'fas fa-dot-circle' , 'clear' => 'fas fa-trash' , 'close' => 'fas fa-times' , ] , 'locale' => substr ( I18n :: getLocale ( ) , 0 , 2 ) ? : 'en-gb' , 'showTodayButton' => true , 'showClear' => true , ] ) ; return sprintf ( '$("%s").datetimepicker(%s);' , $ input , json_encode ( $ options -> toArray ( ) , JSON_PRETTY_PRINT ) ) ; }
Internal function to generate datepicker and timepicker.

Bootstrap Datepicker and Moment.js should be installed via Composer.
@param string $input Target field
@param array $options Options for the datepicker
@return string jQuery code
@see http://eonasdan.github.io/bootstrap-datetimepicker Bootstrap 3 Datepicker v4 documentation
@uses Assets\View\Helper\AssetHelper::css()
@uses Assets\View\Helper\AssetHelper::script()
Internal function to generate datepicker and timepicker .