Skip to content

Commit

Permalink
Merge pull request #717 from frog-pond/hawken/calendar-fixes
Browse files Browse the repository at this point in the history
calendar fixes
  • Loading branch information
hawkrives authored May 7, 2024
2 parents d24ca3f + 19cd82f commit 374808f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/calendar/ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function convertEvents(data, now = moment()) {
}

export async function ical(url, {onlyFuture = true} = {}, now = moment()) {
let body = await get(url).text()
let body = await get(url, {headers: {accept: 'text/calendar'}}).text()

let comp = InternetCalendar.Component.fromString(body)
let events = comp
Expand Down
3 changes: 2 additions & 1 deletion source/calendar/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {z} from 'zod'
const EventConfig = z.object({
startTime: z.boolean(),
endTime: z.boolean(),
subtitle: z.union([z.literal('location')]),
subtitle: z.union([z.literal('location'), z.literal('description')]),
})

export const Event = z.object({
Expand All @@ -12,6 +12,7 @@ export const Event = z.object({
endTime: z.string().datetime(),
title: z.string(),
description: z.string(),
location: z.string().default(''),
isOngoing: z.boolean(),
links: z.array(z.unknown()),
config: EventConfig,
Expand Down
2 changes: 1 addition & 1 deletion source/ccci-carleton-college/v1/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function cave(ctx) {
ctx.cacheControl(ONE_MINUTE)

let url =
'https://www.carleton.edu/student/orgs/cave/calendar/?loadFeed=calendar&stamp=1714844429\n'
'https://www.carleton.edu/student/orgs/cave/calendar/?loadFeed=calendar'
ctx.body = await getInternetCalendar(url)
}

Expand Down

0 comments on commit 374808f

Please sign in to comment.