Skip to content

Commit

Permalink
🐛 Fix ics download #2554
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Oct 9, 2024
1 parent 3a0906b commit 1a86998
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/pageComponents/topicPages/AddToCalendar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useEffect, useState } from 'react'
import { isAfter } from 'date-fns'
import { getEventDates, toUTCDateParts } from '../../common/helpers/dateUtilities'

import type { EventDateType } from '../../types/index'
import { useIntl } from 'react-intl'
import { Button } from '@core/Button'
import { twMerge } from 'tailwind-merge'
import { commonButtonStyling, getVariant } from '@core/Button'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const ics = require('ics')
Expand Down Expand Up @@ -80,7 +80,6 @@ const AddToCalendar = ({ eventDate, title, location }: AddToCalendarProps) => {
title: title,
location: location || '',
}

setFileData(createICS(eventData))
}
}, [eventDate, location, title])
Expand All @@ -95,14 +94,15 @@ const AddToCalendar = ({ eventDate, title, location }: AddToCalendarProps) => {
{ eventTitle: title },
)
return (
<Button
<a
aria-label={atcAriaLabel}
id="atc"
className={twMerge(commonButtonStyling, getVariant('contained'))}
{...(fileData && { href: fileData as string, download: `${title.replace(/ /g, '_')}.ics` })}
>
{/* <Icon data={add} /> */}
{atc}
</Button>
</a>
)
}

Expand Down

0 comments on commit 1a86998

Please sign in to comment.