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

"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a40a49f722e0_3879cd784189a4@gitlab-sidekiq-low-urgency-cpu-bound-v2-656d6f88d7-vdwhn.mail>

MAGENE Sem Joel pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
04aece22 by MAGENE Sem Joel at 2026-06-28T04:29:02+00:00
[BP][FIX] Calendar: ensure weekday headers match the configured first day of the week
---
* [BP][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
---
* [FIX] Calendar: ensure weekday headers match the configured first day of the week

See merge request tikiwiki/tiki!10599

(cherry picked from commit 2e9d303be34e1091fe50e6167f0d099f25903a9b)

See merge request tikiwiki/tiki!10608

(cherry picked from commit 4416658f496ce01d783fab90f11612ea46214493)

See merge request tikiwiki/tiki!10613

- - - - -


3 changed files:

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


Changes:

=====================================
lib/calendar/calendarlib.php
=====================================
@@ -157,7 +157,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,
@@ -1637,7 +1637,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
=====================================
@@ -99,7 +99,7 @@ $.fn.setupEventCalendar = function (
                         document.getElementById("semester").remove();
                     }
                     if (data.type == "timeGridWeek" || data.type == "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/04aece22e78e4ba049d6bec4f79033865ae6ca30

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/04aece22e78e4ba049d6bec4f79033865ae6ca30
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.