We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 60b0a22 commit 7a406b0Copy full SHA for 7a406b0
1 file changed
src/utils/icsGenerator.ts
@@ -1,5 +1,9 @@
1
function formatICSDate(date: Date): string {
2
- return date.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
+ // Convert to UTC for iCalendar format
3
+ // We need to preserve the original time in the user's timezone
4
+ // but format it according to iCalendar specs (UTC/Z format)
5
+ const userTimezoneDate = new Date(date);
6
+ return userTimezoneDate.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
7
}
8
9
export function generateICS(event: {
@@ -11,7 +15,7 @@ export function generateICS(event: {
11
15
}) {
12
16
// Events are typically 2 hours long
13
17
const endDate = new Date(event.startDate.getTime() + 2 * 60 * 60 * 1000);
14
-
18
+
19
const description = [
20
event.description,
21
`Location: ${event.location}`,
0 commit comments