Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 2 additions & 44 deletions src/data/EventsDatabase.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { EventObject } from '../tools/CustomTypes'

const semesterEnd = '5/31/25'
const descriptionForSDW = `The goal of these classes is to equip you with the skills to model and design on a professional
level, as well as create a common ground for all engineers to work together more efficiently and effectively`
const EVENT_INFO: EventObject[] = [
{
title: 'Weekly Solidworks Workshop',
description: descriptionForSDW,
description: `The goal of these classes is to equip you with the skills to model and design on a professional
level, as well as create a common ground for all engineers to work together more efficiently and effectively`,
date: new Date('2025-02-17T17:30:00'),
location: 'The ideas hub (second floor of the engineering building)',
weekly: true,
Expand Down Expand Up @@ -43,47 +42,6 @@ const EVENT_INFO: EventObject[] = [
weekly: true,
endDate: new Date(semesterEnd)
}
// {
// title: 'Weekly Programming Meeting',
// description: 'The weekly meeting for the programming sub-team. Take a look at the code for the robot',
// date: new Date('1/1/2025'),
// time: '5:00pm',
// location: 'The ideas hub (second floor of the engineering building)',
// weekly: true,
// endDate: new Date(semesterEnd)
// },
// {
// title: 'Weekly Electrical Meeting',
// description: 'The weekly meeting for the electrical sub-team. Talk about improved batteries, wiring, and more!',
// date: new Date('1/2/2025'),
// time: '6:00',
// location: 'The ideas hub (second floor of the engineering building)',
// weekly: true,
// endDate: new Date(semesterEnd)
// },
// {
// title: 'Weekly Mechanical Meeting',
// description: 'The weekly meeting for the mechanical sub-team. Learn about the design aspects of robot and 3D model parts.',
// date: new Date('1/2/2025'),
// time: '4:00pm',
// location: 'The ideas hub (second floor of the engineering building)',
// weekly: true,
// endDate: new Date(semesterEnd)
// }
// {
// title: 'Engineering Week Showcase',
// description: 'Meet us to see the robot in action and learn about the club!',
// date: new Date(''),
// time: '11:00 AM',
// location: 'SERC Main Lobbby'
// },
// {
// title: 'Temple Ambler Showcase',
// description: 'Meet us to see the robot in action and learn about the club!',
// date: new Date(''),
// time: '9:15 AM',
// location: 'Temple Ambler Widener'
// }
]

export default EVENT_INFO
15 changes: 8 additions & 7 deletions src/tools/services/getEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ function handleWeeklyEvents(events: EventObject[]): EventObject[] {
return 1
})

// Handle weekly dates
// Handle weekly dates. Set them to be the next occurrence if they are in the past.
events.forEach(event => {
const currentDayForWeek = new Date()
const dayOffset = (7 + event.date.getDay() - currentDayForWeek.getDay()) % 7
const dateComparison = event.date.getTime() - currentDayForWeek.getTime()
if (event.weekly && dateComparison < 0) {
const newDate = currentDayForWeek.getTime() + dayOffset * 24 * 60 * 60 * 1000
event.date = new Date(newDate)
if (event.weekly) {
const currentDate = new Date()
const dayOffset = (7 + event.date.getDay() - currentDate.getDay()) % 7
const nextOccurrence = new Date(currentDate.getTime() + dayOffset * 24 * 60 * 60 * 1000)
if (nextOccurrence < currentDate) {
nextOccurrence.setDate(nextOccurrence.getDate() + 7)
}
}
})

Expand Down