FIX: adds support for location and details in ICS calendar (#26862)

This commit is contained in:
Joffrey JAFFEUX 2024-05-03 16:27:26 +02:00 committed by GitHub
parent 5ac7e01b8d
commit d795e22804
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 5 deletions

View File

@ -25,6 +25,8 @@ export default class DownloadCalendar extends Component {
this.args.model.calendar.dates,
{
recurrenceRule: this.args.model.calendar.recurrenceRule,
location: this.args.model.calendar.location,
details: this.args.model.calendar.details,
}
);
} else {

View File

@ -89,6 +89,8 @@ export function generateIcsData(title, dates, options = {}) {
`DTSTART:${startDate.utc().format("YMMDDTHHmmss")}Z\n` +
`DTEND:${endDate.utc().format("YMMDDTHHmmss")}Z\n` +
(options.recurrenceRule ? `RRULE:${options.recurrenceRule}\n` : ``) +
(options.location ? `LOCATION:${options.location}\n` : ``) +
(options.details ? `DESCRIPTION:${options.details}\n` : ``) +
`SUMMARY:${title}\n` +
"END:VEVENT\n"
);

View File

@ -24,12 +24,21 @@ module("Unit | Utility | download-calendar", function (hooks) {
shouldAdvanceTime: true,
shouldClearNativeTimers: true,
});
const data = generateIcsData("event test", [
const data = generateIcsData(
"event test",
[
{
startsAt: "2021-10-12T15:00:00.000Z",
endsAt: "2021-10-12T16:00:00.000Z",
},
],
{
startsAt: "2021-10-12T15:00:00.000Z",
endsAt: "2021-10-12T16:00:00.000Z",
},
]);
recurrenceRule: "FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR",
location: "Paris",
details: "Good soup",
}
);
assert.equal(
data,
`BEGIN:VCALENDAR
@ -40,6 +49,9 @@ UID:1634050800000_1634054400000
DTSTAMP:20220404T211500Z
DTSTART:20211012T150000Z
DTEND:20211012T160000Z
RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR
LOCATION:Paris
DESCRIPTION:Good soup
SUMMARY:event test
END:VEVENT
END:VCALENDAR`