'use client' import Link from 'next/link' import moment from "moment"; import { useState } from "react" export default function UpcomingEventData() { const [currentMonth, setCurrentMonth] = useState(moment()); // Events normalized with YYYY-MM-DD format const events = [ { id: 1, date: "2024-01-14", time: "05:30 PM", title: "Thai Pongal 2024", location: "Holy Family Croatian Roman Catholic Parish Hall, Kitchener, Canada", image: "/assets/img/event/upcoming-event/thai-pongal.webp", url: "#", }, { id: 2, date: "2024-04-14", title: "AGM", location: "Christ Lutheran Church, Waterloo, ON", image: "/assets/img/event/upcoming-event/agm.webp", url: "#", }, { id: 3, date: "2024-06-22", title: "KW Multicultural Festival", location: "Indian & Sri Lankan Food Court, Victoria Park, Kitchener, ON", image: "/assets/img/event/upcoming-event/kw.webp", url: "#", }, { id: 4, date: "2024-07-07", time: "10:00 AM", title: "TCA Picnic – Potlock", location: "Pinehurst Lake – Sutor Shelter, Ayr, ON", image: "/assets/img/event/upcoming-event/picnic.webp", url: "#", }, { id: 5, date: "2024-07-27", title: "South Asian Family Sports Day", location: "Waterloo Park, Waterloo, ON", image: "/assets/img/event/upcoming-event/sports.webp", url: "#", }, { id: 6, date: "2023-08-23", time: "06:30-08:30 PM", title: "Conestoga College Workshop", location: "Conestoga College – WC 241, Doon Campus, Ontario", image: "/assets/img/event/upcoming-event/workshop.webp", url: "#", }, { id: 7, date: "2023-08-23", time: "06:30-08:30 PM", title: "Tamil Cultural Nite", location: "Doon Campus, Ontario (TBA)", image: "/assets/img/event/upcoming-event/cultural.webp", url: "#", }, { id: 8, date: "2024-10-26", time: "1.00 PM-4.30 PM", title: "TCA – WPL Deepavali Celebrations", location: "Waterloo Public Library, John M. Harper Branch", image: "/assets/img/event/upcoming-event/deepavali.webp", url: "#", }, { id: 9, date: "2024-12-21", time: "05:00 PM-09:00 PM", title: "Christmas & 2024 Year End Celebration", location: "RIM Park, 2001 University Ave E, Waterloo, ON", image: "/assets/img/event/upcoming-event/christmas.webp", url: "#", }, ]; // Get start and end of current month const startOfMonth = currentMonth.clone().startOf("month"); const endOfMonth = currentMonth.clone().endOf("month"); // Generate calendar days const daysInMonth = []; for (let i = 0; i < startOfMonth.day(); i++) { daysInMonth.push(null); } for (let i = 1; i <= endOfMonth.date(); i++) { daysInMonth.push(moment(currentMonth).date(i)); } // Get events for a given date const getEventForDate = (date) => { const dateString = date?.format("YYYY-MM-DD"); return events.filter(event => event.date === dateString); }; // Navigate months const handleMonthChange = (direction) => { setCurrentMonth(currentMonth.clone().add(direction, "months")); }; return (
| {day} | ))}
|---|
| 0 ? "#ce2029" : "white",
color: eventList.length > 0 ? "white" : "black",
}}
title={
eventList.length > 0
? eventList.map(e => e.title).join("\n")
: ""
}
>
{day ? (
{day.date()}
) : (
""
)}
|
);
})}
{event.location}
{event.location}