Thanks for the replies. I don’t need the calendar for what I am doing. I was hoping to tap into the functionality of the event dates where the beginning date selection would change the end date but I think I can figure that out separately.
I ran into an issue though with the Date Widget was not functioning properly when not logged in as admin. I tried on a fresh install of 9.2.0 and nothing. Turns out the JqueryUI was not loading even after including
$this->requireAsset('jquery/ui');
in the controller’s view() function.
Yesterday I found this though and it is working now.
Thank you chemmett
For fellow Googlers…
in a block’s view.php file
<?php
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
$dtfh = $app->make('helper/form/date_time');
?>
<label for="start"><?=t('Start Date')?></label>
<?=$dtfh->date('start', $start)?>
<label for="end"><?=t('End Date')?></label>
<?=$dtfh->date('end', $end)?>
And in the block’s controller.php file’s view function
public function view()
{
$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');
}
Hopefully this will help for others who run into the same situation.
Separately but much less important: the DatePicker runs a script that takes the selected date, formats it properly, and adds it to a hidden text input field. Is there a better way (and I am sure there is) to tap into that value besides doing a setTimeout to wait for the DatePickers script to finish? This is truly not C5 related so feel free to give this the silent treatment.
Thanks again for all your input.
C