?
avatar fevangelou
fevangelou
26 Apr 2017

Steps to reproduce the issue

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).

Expected result

New Joomla 3.7.x JHtml calendar method attributes should control the display JS calandar script.

Actual result

They don't. Visual example here: http://jmp.sh/l3UC5L0

System information (as much as possible)

Joomla 3.7.0 on PHP 7.1.1 (via MAMP)

Additional comments

avatar fevangelou fevangelou - open - 26 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - change - 26 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Apr 2017
avatar fevangelou
fevangelou - comment - 26 Apr 2017

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.

avatar rdeutz
rdeutz - comment - 26 Apr 2017

@dgt41 can you have a look

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2017
Category JavaScript
avatar Fedik
Fedik - comment - 26 Apr 2017

it the same as #15551

step to reproduce:

echo JHtml::_('calendar', '', 'blabla', 'blabla', '%Y-%m-%d', null);

in result you should get a working callendar, but you get a bit broken calendar 😉

avatar dgt41
dgt41 - comment - 26 Apr 2017

@fevangelou Fotis can you paste in a codepen, the exact code you are using?

avatar Fedik
Fedik - comment - 26 Apr 2017

@dgt41 see my previous comment

avatar fevangelou
fevangelou - comment - 26 Apr 2017

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";
avatar janich
janich - comment - 26 Apr 2017

Not to highjack this thread, but the start of week does not seem to be working in your screenshot?

avatar fevangelou
fevangelou - comment - 26 Apr 2017

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.

avatar hikashop-nicolas
hikashop-nicolas - comment - 26 Apr 2017

I confirm that this fix fixes the issue for HikaShop calendar selectors too.

avatar fevangelou
fevangelou - comment - 26 Apr 2017

Added related PR with the fix.

avatar PhocaCz
PhocaCz - comment - 26 Apr 2017

Hi, confirmed:
before the change:
Before change
after the change:
After change

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Apr 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-04-26 10:53:51
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 26 Apr 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 26 Apr 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 26 Apr 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 26 Apr 2017

closed as having PR #15573


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15569.

avatar domydev
domydev - comment - 4 Oct 2017
content->id)) $created_date = date("Y-m-d"); else $created_date = $this->content->date_created; $time = date('H:i:s',strtotime($created_date)); echo JHTML::_('calendar', $created_date, "date_created", "date_created", "%Y-%m-%d $time", null); Bizzard not save backend for my personal component 3.7.5 > 3.8 help me save backend calendar value
avatar wilsonge
wilsonge - comment - 4 Oct 2017

@domydev this issue has been fixed - so if you are still having problems please create a new support ticket

Add a Comment

Login with GitHub to post a comment