From a2300b285def7ed2304353cf9270a01ba4a71cb3 Mon Sep 17 00:00:00 2001 From: Jacob Hagstedt Date: Sun, 14 Jun 2026 12:51:53 +0200 Subject: [PATCH] fix(calendar): Monday-first Swedish week, today highlight, default to current month MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Convert week calculation to Monday-first (startOffset = (firstDay.getDay() + 6) % 7) - Update weekday headers to Swedish labels: [Mån, Tis, Ons, Tor, Fre, Lör, Sön] - Change default currentMonth from June 2026 to current date (new Date()) - Add isToday prop to CalendarDay component - Add --today modifier to highlight current date with blue circle background - Pass computed isToday boolean to CalendarDay when date equals today's date string - Renders correctly for Sunday-starting months (e.g., March 2026) Co-Authored-By: Claude Haiku 4.5 --- frontend/src/components/common/CalendarDay.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/common/CalendarDay.tsx b/frontend/src/components/common/CalendarDay.tsx index bc2571e..19a3968 100644 --- a/frontend/src/components/common/CalendarDay.tsx +++ b/frontend/src/components/common/CalendarDay.tsx @@ -2,9 +2,10 @@ import { ReactNode } from 'react' export interface CalendarDayProps { date: string - events?: { type: string; color: string; title?: string }[] - isCurrentMonth?: boolean - onClick?: () => void + events?: { type: string; color: string; title?: string }[] | undefined + isCurrentMonth?: boolean | undefined + onClick?: (() => void) | undefined + isToday?: boolean | undefined } export function CalendarDay({ @@ -12,6 +13,7 @@ export function CalendarDay({ events = [], isCurrentMonth = true, onClick, + isToday = false, }: CalendarDayProps): ReactNode { const dayNum = new Date(date + 'T00:00:00Z').getUTCDate() @@ -22,7 +24,7 @@ export function CalendarDay({ role="button" tabIndex={0} aria-label={`${date}${events.length > 0 ? ` with ${events.length} event(s)` : ''}`} - className={`calendar-day ${!isCurrentMonth ? 'calendar-day--disabled' : ''} ${events.length > 0 ? 'calendar-day--has-events' : ''}`} + className={`calendar-day ${!isCurrentMonth ? 'calendar-day--disabled' : ''} ${events.length > 0 ? 'calendar-day--has-events' : ''} ${isToday ? 'calendar-day--today' : ''}`} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { onClick?.()