Directly calling JHtml::('calendar', ...) in components (e.g. K2) does not work as expected. Even though the JHtml calendar method sets time to be shown by default, directly calling JHtml::('calendar', ...) either with the "showTime" attribute set to "true" or none (which would default to "true" either way), it never displays the JS calendar with the time options. Visual example here: http://jmp.sh/l3UC5L0
Other older attributes (e.g. "readonly") work as expected (probably because they don't modify the JS calendar but the HTML form field itself).
New Joomla 3.7.x JHtml calendar method attributes should control the display JS calandar script.
They don't. Visual example here: http://jmp.sh/l3UC5L0
Joomla 3.7.0 on PHP 7.1.1 (via MAMP)
Labels |
Added:
?
|
Category | ⇒ | JavaScript |
@fevangelou Fotis can you paste in a codepen, the exact code you are using?
In /libraries/cms/html/html.php, this evaluates wrongly:
$showTime = !empty($showTime) ? ($showTime === 'true' ? "1" : "0") : "1";
$todayBtn = !empty($todayBtn) ? ($todayBtn === 'true' ? "1" : "0") : "1";
$weekNumbers = !empty($weekNumbers) ? ($weekNumbers === 'true' ? "1" : "0") : "0";
$fillTable = !empty($fillTable) ? ($fillTable === 'true' ? "1" : "0") : "1";
$singleHeader = !empty($singleHeader) ? ($singleHeader === 'true' ? "1" : "0") : "0";
Not to highjack this thread, but the start of week does not seem to be working in your screenshot?
The fix requires that this block in /libraries/cms/html/html.php is changed from:
$showTime = !empty($showTime) ? ($showTime === 'true' ? "1" : "0") : "1";
$todayBtn = !empty($todayBtn) ? ($todayBtn === 'true' ? "1" : "0") : "1";
$weekNumbers = !empty($weekNumbers) ? ($weekNumbers === 'true' ? "1" : "0") : "0";
$fillTable = !empty($fillTable) ? ($fillTable === 'true' ? "1" : "0") : "1";
$singleHeader = !empty($singleHeader) ? ($singleHeader === 'true' ? "1" : "0") : "0";
to
$showTime = ($showTime) ? "1" : "0";
$todayBtn = ($todayBtn) ? "1" : "0";
$weekNumbers = ($weekNumbers) ? "1" : "0";
$fillTable = ($fillTable) ? "1" : "0";
$singleHeader = ($singleHeader) ? "1" : "0";
And now it works as expected, whether attributes are set or not.
I confirm that this fix fixes the issue for HikaShop calendar selectors too.
Added related PR with the fix.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-26 10:53:51 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/15569
closed as having PR #15573
Here's a screenshot of the rendered data attributes: http://jmp.sh/heTySpS
You'll notice (at the bottom) that they do not conform to the default attributes set in JHtml's calendar method.