From 14e9ce5aba829cd162aa932f6e410d19634f5870 Mon Sep 17 00:00:00 2001 From: Denis Papec Date: Thu, 28 Sep 2023 09:03:51 +0100 Subject: [PATCH] Finished first day in week config Signed-off-by: Denis Papec --- src/utils/config/service-helpers.js | 2 ++ src/widgets/calendar/monthly-view.jsx | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 543bf5ee..91e5b75c 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -358,6 +358,7 @@ export function cleanServiceGroups(groups) { mappings, // customapi widget refreshInterval, integrations, // calendar widget + firstDayInWeek, } = cleanedService.widget; let fieldsList = fields; @@ -443,6 +444,7 @@ export function cleanServiceGroups(groups) { } if (type === "calendar") { if (integrations) cleanedService.widget.integrations = integrations; + if (firstDayInWeek) cleanedService.widget.firstDayInWeek = firstDayInWeek; } } diff --git a/src/widgets/calendar/monthly-view.jsx b/src/widgets/calendar/monthly-view.jsx index 383d9881..5d4a2b17 100644 --- a/src/widgets/calendar/monthly-view.jsx +++ b/src/widgets/calendar/monthly-view.jsx @@ -98,13 +98,13 @@ export default function MonthlyView({ service }) { const dayNames = Info.weekdays("short", { locale: i18n.language }); - const firstDayInCalendar = widget?.firstDayInCalendar ? widget?.firstDayInCalendar?.toLowerCase() : "monday"; - for (let i = 1; i < dayInWeekId[firstDayInCalendar]; i+=1) { + const firstDayInWeekCalendar = widget?.firstDayInWeek ? widget?.firstDayInWeek?.toLowerCase() : "monday"; + for (let i = 1; i < dayInWeekId[firstDayInWeekCalendar]; i+=1) { dayNames.push(dayNames.shift()); } - const daysInWeek = useMemo(() => [ ...Array(7).keys() ].map( i => i + dayInWeekId[firstDayInCalendar] - ), [(firstDayInCalendar)]); + const daysInWeek = useMemo(() => [ ...Array(7).keys() ].map( i => i + dayInWeekId[firstDayInWeekCalendar] + ), [(firstDayInWeekCalendar)]); if (!showDate) { return
;