Mini calendar date out by 1 day with Monday first

More
10 years 3 months ago #41410 by John
Hi,

I've identified a bug with the mini calendar. There is a setting in the configuration to select whether the first day of the week should be Monday or Sunday. When you select Monday the dates are shown fine on first page load (MTWTFSS) but when clicking forward or backward the ajax request refreshes the calendar with the Sunday first table headings (SMTWTFS) but loads the dates correctly with Monday first. This results in the dates being out by one day with the table headings.

My solution was to create a template override file by copying the file components/com_eventbooking/views/calendar/tmpl/mini.php to
templates/your_tempate/html/com_eventbooking/calendar/mini.php

Around line 12 - just after the $data declaration add the following code;
Code:
for( $i = 0; $i < 7; $i++ ) { $this->days[$i] = substr(EventbookingHelperData::getDayName(($i + $data['startday']) % 7, true ),0,1); }

This simply recreates $this->days taking into consideration the $data setting.

Hope this helps and thank you for a great extension.

Regards
John

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #41482 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Mini calendar date out by 1 day with Monday first
Great. Thanks John for sharing the solution. I am going to check the code again and implement this fix into the download package.

Thanks again !

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc