|
@ -9,6 +9,7 @@ import { format, parseISO } from 'date-fns'; |
|
|
}) |
|
|
}) |
|
|
export class IcsService { |
|
|
export class IcsService { |
|
|
private readonly ICS_DATE_FORMAT = 'yyyyMMdd'; |
|
|
private readonly ICS_DATE_FORMAT = 'yyyyMMdd'; |
|
|
|
|
|
private readonly ICS_LINE_BREAK = '\r\n'; |
|
|
|
|
|
|
|
|
public constructor() {} |
|
|
public constructor() {} |
|
|
|
|
|
|
|
@ -30,7 +31,7 @@ export class IcsService { |
|
|
}); |
|
|
}); |
|
|
const footer = ['END:VCALENDAR']; |
|
|
const footer = ['END:VCALENDAR']; |
|
|
|
|
|
|
|
|
return [...header, ...events, ...footer].join('\n'); |
|
|
return [...header, ...events, ...footer].join(this.ICS_LINE_BREAK); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private getEvent({ |
|
|
private getEvent({ |
|
@ -54,6 +55,6 @@ export class IcsService { |
|
|
`DTEND;VALUE=DATE:${format(date, this.ICS_DATE_FORMAT)}`, |
|
|
`DTEND;VALUE=DATE:${format(date, this.ICS_DATE_FORMAT)}`, |
|
|
`SUMMARY:${capitalize(type)} ${symbol}`, |
|
|
`SUMMARY:${capitalize(type)} ${symbol}`, |
|
|
'END:VEVENT' |
|
|
'END:VEVENT' |
|
|
].join('\n'); |
|
|
].join(this.ICS_LINE_BREAK); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|