[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Calendar: ensure weekday headers match the configured first day of the week

"Domeshow Emmanuel \(@Domeshow\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a3e87be81bfd_3848bf9810224@gitlab-sidekiq-low-urgency-cpu-bound-v2-658cd667f7-rsgkn.mail>

Domeshow Emmanuel pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
2e9d303b by MAGENE Sem Joel at 2026-06-26T16:53:13+03:00
[FIX] Calendar: ensure weekday headers match the configured first day of the week
---
* [FIX] Calendar: ensure weekday headers match the configured first day of the week

See merge request tikiwiki/tiki!10599

- - - - -


3 changed files:

- lib/calendar/calendarlib.php
- lib/test/Calendar/DateTest.php
- src/js/jquery-tiki/tiki-calendar.js


Changes:

=====================================
lib/calendar/calendarlib.php
=====================================
@@ -178,7 +178,7 @@ class CalendarLib extends TikiLib
         }
         return  [
             'timeFormat'       => $prefs['display_12hr_clock'] === 'y',
-            'firstDayofWeek'   => 0,//$firstDayofWeek,
+            'firstDayofWeek'   => $this->firstDayofWeek(),
             'display_timezone' => $prefs['display_timezone'],
             'language'         => $prefs['language'],
             'minHourOfDay'     => $minHourOfDay,
@@ -1674,7 +1674,7 @@ class CalendarLib extends TikiLib
         } else {
             $firstDayofWeek = $prefs['calendar_firstDayofWeek'];
         }
-        return $firstDayofWeek;
+        return (int) $firstDayofWeek;
     }
     // return detail on a date
     /**


=====================================
lib/test/Calendar/DateTest.php
=====================================
@@ -60,6 +60,23 @@ class Calendar_DateTest extends TikiTestCase
         $this->assertEquals('2010-09-05', TikiLib::date_format('%Y-%m-%d', $cell[5][6]['date']));
     }
 
+    public function testFirstDayOfWeekReturnsIntegerForExplicitPreference(): void
+    {
+        global $prefs;
+        $calendarlib = TikiLib::lib('calendar');
+        $originalPreference = $prefs['calendar_firstDayofWeek'];
+
+        try {
+            $prefs['calendar_firstDayofWeek'] = '0';
+            $this->assertSame(0, $calendarlib->firstDayofWeek());
+
+            $prefs['calendar_firstDayofWeek'] = '1';
+            $this->assertSame(1, $calendarlib->firstDayofWeek());
+        } finally {
+            $prefs['calendar_firstDayofWeek'] = $originalPreference;
+        }
+    }
+
     public function testPrevious(): void
     {
         global $tikilib;


=====================================
src/js/jquery-tiki/tiki-calendar.js
=====================================
@@ -328,7 +328,7 @@ $.fn.setupEventCalendar = function (
                     removeMonthRangeControls();
                     removeListPeriodControls();
                     if (currentViewType == "timeGridWeek" || currentViewType == "listWeek") {
-                        calendarContainer[0].setOption("duration", { days: 7 });
+                        calendarContainer[0].setOption("duration", { weeks: 1 });
                         calendarContainer[0].setOption("dayCellFormat", function (dayCell) {
                             return moment(dayCell).format("D");
                         });



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2e9d303be34e1091fe50e6167f0d099f25903a9b

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/2e9d303be34e1091fe50e6167f0d099f25903a9b
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.