V9: which asset provides date picker?

The date picker in v8 was provided by the ‘jquery/ui’ asset. Now it’s gone and the date picker is not available for non admin users in the front end. How do I load it? Which asset?

Looks like it’s ‘core/cms’. Requiring this asset loads the date picker. But why should users download a 2MB cms.js just for a date picker? Is there a way to only load the jquery-ui like it used to be in v8?

The in-browser ‘date’ input types are pretty good with current browsers. The concrete form helper now supports doing a simple $form->date(…) like you would $form->text(…) etc., and that sidesteps the entire problem.

1 Like

@JohntheFish , thank you! That works.

Is there any way to remove the date placeholder from the date input without ‘webkit’?

Ran into this issue today also. The built in form block still tries to use the jQuery UI datepicker if you have a date/time field, which is broken unless your theme pulls in all of core/cms or you manually add jQuery UI to your theme. My fix in page_theme.php registerAssets():

$al = \Concrete\Core\Asset\AssetList::getInstance();
$al->register('css', 'jquery/ui', 'css/jquery-ui.css');
$al->register('javascript', 'jquery/ui', 'https://code.jquery.com/ui/1.13.2/jquery-ui.min.js', ['local' => false]);
$al->registerGroup('jquery/ui', [
    ['javascript', 'jquery/ui'],
    ['css', 'jquery/ui']
]);
$this->requireAsset('jquery/ui');
1 Like

Hi @chemmett - it would probably be worth seeing if an issue exists for this and if not reporting it so it can get fixed in future versions - Thanks!

Thanks, @EvanCooper! I did find some open issues surrounding this like [v9] bug: Datetime picker widget in Dashboard has no Next/Prev icons and not loading in frontend · Issue #10099 · concretecms/concretecms · GitHub so they’re aware of the issue. It sounds like the fix they’re going for is to switch the form date/time fields to use native HTML5 inputs rather than jQuery UI.
I also filed this bug about the rating form widget Multiple form helpers broken · Issue #11138 · concretecms/concretecms · GitHub which has the same root cause.

1 Like

The core form helper class now adapts to any html5 input type (including date) specifically for this purpose.

Yep, I think really all that needs done is change the form blocks to use $formHelper->inputType() for date/time fields instead of the old DateTime helper class. I might try to work on this soon.

Nice, thanks for submitting those bugs - I shot you over the bug reporter badge. It’s appreciated!