Amirul Anwar 4 months ago
parent
commit
713ca49f67
2 changed files with 13 additions and 14 deletions
  1. 1
    1
      config/app.php
  2. 12
    13
      resources/views/modals/calendar-modal.blade.php

+ 1
- 1
config/app.php View File

70
     |
70
     |
71
     */
71
     */
72
 
72
 
73
-    'timezone' => 'UTC',
73
+    'timezone' => 'Asia/Kuala_Lumpur',
74
 
74
 
75
     /*
75
     /*
76
     |--------------------------------------------------------------------------
76
     |--------------------------------------------------------------------------

+ 12
- 13
resources/views/modals/calendar-modal.blade.php View File

279
 
279
 
280
         if (os === 'iOS') {
280
         if (os === 'iOS') {
281
             const icsContent = `BEGIN:VCALENDAR
281
             const icsContent = `BEGIN:VCALENDAR
282
-                                VERSION:2.0
283
-                                BEGIN:VEVENT
284
-                                SUMMARY:${title}
285
-                                DTSTART:${startDate}
286
-                                DTEND:${endDate}
287
-                                DESCRIPTION:${details}
288
-                                LOCATION:${location}
289
-                                END:VEVENT
290
-                                END:VCALENDAR`;
282
+VERSION:2.0
283
+BEGIN:VEVENT
284
+SUMMARY:${title}
285
+DTSTART:${startDate}
286
+DTEND:${endDate}
287
+DESCRIPTION:${details}
288
+LOCATION:${location}
289
+END:VEVENT
290
+END:VCALENDAR`;
291
 
291
 
292
-            const blob = new Blob([icsContent], { type: 'text/calendar' });
293
-            const url = URL.createObjectURL(blob);
292
+            const dataURI = 'data:text/calendar;charset=utf-8,' + encodeURIComponent(icsContent);
294
             const a = document.createElement('a');
293
             const a = document.createElement('a');
295
-            a.href = url;
294
+            a.href = dataURI;
296
             a.download = 'event.ics';
295
             a.download = 'event.ics';
297
             document.body.appendChild(a);
296
             document.body.appendChild(a);
298
             a.click();
297
             a.click();
299
             document.body.removeChild(a);
298
             document.body.removeChild(a);
300
-            URL.revokeObjectURL(url);
301
         } else if (os === 'Android') {
299
         } else if (os === 'Android') {
302
             const googleCalendarUrl = `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(title)}&dates=${startDate}/${endDate}&details=${encodeURIComponent(details)}&location=${encodeURIComponent(location)}`;
300
             const googleCalendarUrl = `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(title)}&dates=${startDate}/${endDate}&details=${encodeURIComponent(details)}&location=${encodeURIComponent(location)}`;
303
             window.open(googleCalendarUrl, '_blank');
301
             window.open(googleCalendarUrl, '_blank');
305
             alert('Your device is not supported for this feature.');
303
             alert('Your device is not supported for this feature.');
306
         }
304
         }
307
     });
305
     });
306
+
308
 </script>
307
 </script>
309
   @endpush
308
   @endpush

Loading…
Cancel
Save