Spaces:
Running
Running
| export interface Holiday { | |
| id: string | |
| title: string | |
| date: string // MM-DD format for recurring, or YYYY-MM-DD for specific | |
| type: 'religious' | 'national' | 'cultural' | 'personal' | 'other' | |
| color: string | |
| } | |
| export const recurringHolidays: Holiday[] = [ | |
| // Fixed Date Holidays (MM-DD) | |
| { id: 'new-year', title: "New Year's Day", date: '01-01', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'epiphany', title: "Epiphany", date: '01-06', type: 'religious', color: 'bg-purple-500' }, | |
| { id: 'orth-xmas', title: "Orthodox Christmas", date: '01-07', type: 'religious', color: 'bg-purple-500' }, | |
| { id: 'mlk', title: "Martin Luther King Jr. Day", date: '01-20', type: 'national', color: 'bg-blue-500' }, // Approximate (3rd Mon) - simplifying for fixed list or need logic | |
| { id: 'australia', title: "Australia Day", date: '01-26', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'republic-india', title: "Republic Day (India)", date: '01-26', type: 'national', color: 'bg-orange-500' }, | |
| { id: 'valentines', title: "Valentine's Day", date: '02-14', type: 'cultural', color: 'bg-pink-500' }, | |
| { id: 'presidents', title: "Presidents' Day", date: '02-17', type: 'national', color: 'bg-blue-500' }, // Approximate | |
| { id: 'womens', title: "Intl. Women's Day", date: '03-08', type: 'cultural', color: 'bg-pink-500' }, | |
| { id: 'st-patrick', title: "St. Patrick's Day", date: '03-17', type: 'cultural', color: 'bg-green-500' }, | |
| { id: 'nowruz', title: "Nowruz", date: '03-21', type: 'cultural', color: 'bg-green-500' }, | |
| { id: 'earth', title: "Earth Day", date: '04-22', type: 'cultural', color: 'bg-green-600' }, | |
| { id: 'anzac', title: "ANZAC Day", date: '04-25', type: 'national', color: 'bg-red-500' }, | |
| { id: 'labor', title: "Labor Day (Intl)", date: '05-01', type: 'national', color: 'bg-red-500' }, | |
| { id: 'cinco', title: "Cinco de Mayo", date: '05-05', type: 'cultural', color: 'bg-green-500' }, | |
| { id: 'victory-eu', title: "Victory Day (Europe)", date: '05-08', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'juneteenth', title: "Juneteenth", date: '06-19', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'yoga', title: "Intl. Day of Yoga", date: '06-21', type: 'cultural', color: 'bg-orange-500' }, | |
| { id: 'canada', title: "Canada Day", date: '07-01', type: 'national', color: 'bg-red-500' }, | |
| { id: 'us-indep', title: "Independence Day (USA)", date: '07-04', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'bastille', title: "Bastille Day", date: '07-14', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'indep-india', title: "Independence Day (India)", date: '08-15', type: 'national', color: 'bg-orange-500' }, | |
| { id: 'reuben-bday', title: "Reuben's Birthday", date: '09-16', type: 'personal', color: 'bg-gradient-to-r from-purple-500 to-pink-500' }, | |
| { id: 'german-unity', title: "German Unity Day", date: '10-03', type: 'national', color: 'bg-yellow-500' }, | |
| { id: 'halloween', title: "Halloween", date: '10-31', type: 'cultural', color: 'bg-orange-500' }, | |
| { id: 'saints', title: "All Saints' Day", date: '11-01', type: 'religious', color: 'bg-purple-500' }, | |
| { id: 'souls', title: "All Souls' Day", date: '11-02', type: 'religious', color: 'bg-purple-500' }, | |
| { id: 'remembrance', title: "Remembrance Day", date: '11-11', type: 'national', color: 'bg-red-500' }, | |
| { id: 'veterans', title: "Veterans Day", date: '11-11', type: 'national', color: 'bg-blue-500' }, | |
| { id: 'xmas', title: "Christmas Day", date: '12-25', type: 'religious', color: 'bg-green-600' }, | |
| { id: 'boxing', title: "Boxing Day", date: '12-26', type: 'cultural', color: 'bg-blue-500' }, | |
| { id: 'nye', title: "New Year's Eve", date: '12-31', type: 'cultural', color: 'bg-purple-500' }, | |
| ] | |
| // Function to generate variable date holidays (Easter, Diwali, Eid, etc.) | |
| // This is a simplified approximation for demonstration purposes | |
| export const getVariableHolidays = (year: number): Holiday[] => { | |
| const holidays: Holiday[] = [] | |
| // Easter (Western) - Simplified algorithm | |
| const a = year % 19 | |
| const b = Math.floor(year / 100) | |
| const c = year % 100 | |
| const d = Math.floor(b / 4) | |
| const e = b % 4 | |
| const f = Math.floor((b + 8) / 25) | |
| const g = Math.floor((b - f + 1) / 3) | |
| const h = (19 * a + b - d - g + 15) % 30 | |
| const i = Math.floor(c / 4) | |
| const k = c % 4 | |
| const l = (32 + 2 * e + 2 * i - h - k) % 7 | |
| const m = Math.floor((a + 11 * h + 22 * l) / 451) | |
| const month = Math.floor((h + l - 7 * m + 114) / 31) | |
| const day = ((h + l - 7 * m + 114) % 31) + 1 | |
| const easterDate = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}` | |
| holidays.push({ id: `easter-${year}`, title: "Easter Sunday", date: easterDate, type: 'religious', color: 'bg-purple-500' }) | |
| // Good Friday (2 days before Easter) | |
| const gfDate = new Date(year, month - 1, day - 2) | |
| holidays.push({ | |
| id: `good-friday-${year}`, | |
| title: "Good Friday", | |
| date: `${year}-${String(gfDate.getMonth() + 1).padStart(2, '0')}-${String(gfDate.getDate()).padStart(2, '0')}`, | |
| type: 'religious', | |
| color: 'bg-purple-500' | |
| }) | |
| // Thanksgiving (USA) - 4th Thursday of November | |
| const nov1 = new Date(year, 10, 1) | |
| const dayOfWeek = nov1.getDay() // 0=Sun, 1=Mon... | |
| const offset = (4 - dayOfWeek + 7) % 7 // Days to first Thursday | |
| const thanksgivingDay = 1 + offset + 21 // 4th Thursday | |
| holidays.push({ | |
| id: `thanksgiving-${year}`, | |
| title: "Thanksgiving (USA)", | |
| date: `${year}-11-${String(thanksgivingDay).padStart(2, '0')}`, | |
| type: 'national', | |
| color: 'bg-orange-600' | |
| }) | |
| // Diwali (Approximation - usually Oct/Nov) | |
| // Hardcoding for 2024-2026 for demo | |
| if (year === 2024) holidays.push({ id: 'diwali-24', title: "Diwali", date: '2024-11-01', type: 'religious', color: 'bg-orange-500' }) | |
| if (year === 2025) holidays.push({ id: 'diwali-25', title: "Diwali", date: '2025-10-20', type: 'religious', color: 'bg-orange-500' }) | |
| if (year === 2026) holidays.push({ id: 'diwali-26', title: "Diwali", date: '2026-11-08', type: 'religious', color: 'bg-orange-500' }) | |
| // Eid al-Fitr (Approximation) | |
| if (year === 2024) holidays.push({ id: 'eid-24', title: "Eid al-Fitr", date: '2024-04-10', type: 'religious', color: 'bg-green-600' }) | |
| if (year === 2025) holidays.push({ id: 'eid-25', title: "Eid al-Fitr", date: '2025-03-31', type: 'religious', color: 'bg-green-600' }) | |
| // Lunar New Year | |
| if (year === 2024) holidays.push({ id: 'lny-24', title: "Lunar New Year", date: '2024-02-10', type: 'cultural', color: 'bg-red-600' }) | |
| if (year === 2025) holidays.push({ id: 'lny-25', title: "Lunar New Year", date: '2025-01-29', type: 'cultural', color: 'bg-red-600' }) | |
| // Other specific festivals mentioned in prompt/image | |
| if (year === 2025) { | |
| holidays.push({ id: 'chhath-25', title: "Chhath Puja", date: '2025-10-27', type: 'religious', color: 'bg-blue-400' }) | |
| holidays.push({ id: 'culture-jp-25', title: "Culture Day (Japan)", date: '2025-11-03', type: 'cultural', color: 'bg-blue-400' }) | |
| holidays.push({ id: 'guru-nanak-25', title: "Guru Nanak Jayanti", date: '2025-11-05', type: 'religious', color: 'bg-purple-400' }) | |
| holidays.push({ id: 'guru-tegh-25', title: "Guru Tegh Bahadur's Martyrdom Day", date: '2025-11-24', type: 'religious', color: 'bg-purple-400' }) | |
| } | |
| return holidays | |
| } | |