Finished first day in week config

Signed-off-by: Denis Papec <denis.papec@gmail.com>
This commit is contained in:
Denis Papec 2023-09-28 09:03:51 +01:00
parent 97dd781aca
commit 14e9ce5aba
No known key found for this signature in database
GPG Key ID: DE0912C69A47222C
2 changed files with 6 additions and 4 deletions

View File

@ -358,6 +358,7 @@ export function cleanServiceGroups(groups) {
mappings, // customapi widget mappings, // customapi widget
refreshInterval, refreshInterval,
integrations, // calendar widget integrations, // calendar widget
firstDayInWeek,
} = cleanedService.widget; } = cleanedService.widget;
let fieldsList = fields; let fieldsList = fields;
@ -443,6 +444,7 @@ export function cleanServiceGroups(groups) {
} }
if (type === "calendar") { if (type === "calendar") {
if (integrations) cleanedService.widget.integrations = integrations; if (integrations) cleanedService.widget.integrations = integrations;
if (firstDayInWeek) cleanedService.widget.firstDayInWeek = firstDayInWeek;
} }
} }

View File

@ -98,13 +98,13 @@ export default function MonthlyView({ service }) {
const dayNames = Info.weekdays("short", { locale: i18n.language }); const dayNames = Info.weekdays("short", { locale: i18n.language });
const firstDayInCalendar = widget?.firstDayInCalendar ? widget?.firstDayInCalendar?.toLowerCase() : "monday"; const firstDayInWeekCalendar = widget?.firstDayInWeek ? widget?.firstDayInWeek?.toLowerCase() : "monday";
for (let i = 1; i < dayInWeekId[firstDayInCalendar]; i+=1) { for (let i = 1; i < dayInWeekId[firstDayInWeekCalendar]; i+=1) {
dayNames.push(dayNames.shift()); dayNames.push(dayNames.shift());
} }
const daysInWeek = useMemo(() => [ ...Array(7).keys() ].map( i => i + dayInWeekId[firstDayInCalendar] const daysInWeek = useMemo(() => [ ...Array(7).keys() ].map( i => i + dayInWeekId[firstDayInWeekCalendar]
), [(firstDayInCalendar)]); ), [(firstDayInWeekCalendar)]);
if (!showDate) { if (!showDate) {
return <div className="w-full text-center" />; return <div className="w-full text-center" />;