Amirul Anwar 4 月之前
父節點
當前提交
713ca49f67
共有 2 個檔案被更改,包括 13 行新增14 行删除
  1. 1
    1
      config/app.php
  2. 12
    13
      resources/views/modals/calendar-modal.blade.php

+ 1
- 1
config/app.php 查看文件

@@ -70,7 +70,7 @@ return [
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 查看文件

@@ -279,25 +279,23 @@
279 279
 
280 280
         if (os === 'iOS') {
281 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 293
             const a = document.createElement('a');
295
-            a.href = url;
294
+            a.href = dataURI;
296 295
             a.download = 'event.ics';
297 296
             document.body.appendChild(a);
298 297
             a.click();
299 298
             document.body.removeChild(a);
300
-            URL.revokeObjectURL(url);
301 299
         } else if (os === 'Android') {
302 300
             const googleCalendarUrl = `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(title)}&dates=${startDate}/${endDate}&details=${encodeURIComponent(details)}&location=${encodeURIComponent(location)}`;
303 301
             window.open(googleCalendarUrl, '_blank');
@@ -305,5 +303,6 @@
305 303
             alert('Your device is not supported for this feature.');
306 304
         }
307 305
     });
306
+
308 307
 </script>
309 308
   @endpush

Loading…
取消
儲存