Commit e4a2eaa 1 parent bd51044 commit e4a2eaa Copy full SHA for e4a2eaa
File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ export const ics = (calendarEvent: CalendarEvent): string => {
177
177
. replace ( / ( \\ n ) [ \s \t ] + / gm, "\\n" ) ;
178
178
179
179
const { start, end } = formatTimes ( event , event . allDay ? "allDay" : "dateTimeUTC" ) ;
180
+ const dateStamp = dayjs ( new Date ( ) ) . utc ( ) . format ( TimeFormats [ "dateTimeUTC" ] ) ;
180
181
const calendarChunks = [
181
182
{
182
183
key : "BEGIN" ,
@@ -186,6 +187,10 @@ export const ics = (calendarEvent: CalendarEvent): string => {
186
187
key : "VERSION" ,
187
188
value : "2.0" ,
188
189
} ,
190
+ {
191
+ key : "PRODID" ,
192
+ value : event . title
193
+ } ,
189
194
{
190
195
key : "BEGIN" ,
191
196
value : "VEVENT" ,
@@ -202,6 +207,10 @@ export const ics = (calendarEvent: CalendarEvent): string => {
202
207
key : "DTEND" ,
203
208
value : end ,
204
209
} ,
210
+ {
211
+ key : "DTSTAMP" ,
212
+ value : dateStamp ,
213
+ } ,
205
214
{
206
215
key : "RRULE" ,
207
216
value : event . rRule ,
@@ -222,6 +231,10 @@ export const ics = (calendarEvent: CalendarEvent): string => {
222
231
key : "ORGANIZER" ,
223
232
value : event . organizer ,
224
233
} ,
234
+ {
235
+ key : "UID" ,
236
+ value : Math . floor ( Math . random ( ) * 100000 ) . toString ( ) . replace ( "." , "" ) ,
237
+ } ,
225
238
{
226
239
key : "END" ,
227
240
value : "VEVENT" ,
@@ -239,10 +252,10 @@ export const ics = (calendarEvent: CalendarEvent): string => {
239
252
if ( chunk . key == "ORGANIZER" ) {
240
253
const value = chunk . value as CalendarEventOrganizer ;
241
254
calendarUrl += `${ chunk . key } ;${ encodeURIComponent (
242
- `CN=${ value . name } :MAILTO:${ value . email } \n`
255
+ `CN=${ value . name } :MAILTO:${ value . email } \r\ n`
243
256
) } `;
244
257
} else {
245
- calendarUrl += `${ chunk . key } :${ encodeURIComponent ( `${ chunk . value } \n` ) } ` ;
258
+ calendarUrl += `${ chunk . key } :${ encodeURIComponent ( `${ chunk . value } \r\ n` ) } ` ;
246
259
}
247
260
}
248
261
} ) ;
You can’t perform that action at this time.
0 commit comments