Skip to content

Commit

Permalink
fix: ical month is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Feb 19, 2024
1 parent 987682a commit 16ed2c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/[lang]/timetable/calendar.ics/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ export async function GET(request: Request) {
title: course.course.name_zh!,
description: `${course.course.name_en!}\n${course.course.teacher_zh}\n${course.course.teacher_en}\nhttps://nthumods.com/courses/${course.course.raw_id}`,
location: course.venue,
start: [semStart.getFullYear(), semStart.getMonth(), semStart.getDate()+course.dayOfWeek, getHours(start), getMinutes(start)],
end: [semStart.getFullYear(), semStart.getMonth(), semStart.getDate()+course.dayOfWeek, getHours(end), getMinutes(end)],
start: [semStart.getFullYear(), semStart.getMonth()+1, semStart.getDate()+course.dayOfWeek, getHours(start), getMinutes(start)],
end: [semStart.getFullYear(), semStart.getMonth()+1, semStart.getDate()+course.dayOfWeek, getHours(end), getMinutes(end)],
calName: 'NTHUMods',

recurrenceRule: `FREQ=WEEKLY;BYDAY=${day};INTERVAL=1;UNTIL=${formatDateTime(semEnd)}`
}
}
}))
if(icss.error) throw icss.error;
return new Response(icss.value!, { status: 200, headers: { 'Content-Type': 'text/calendar' } })
Expand Down

0 comments on commit 16ed2c4

Please sign in to comment.