111
This commit is contained in:
parent
9a7532b7f7
commit
4ba12356e0
18
register.php
18
register.php
@ -254,24 +254,30 @@ if (!$webinar) {
|
||||
formContainer.style.display = 'none';
|
||||
const webinarTitle = encodeURIComponent(data.webinar_title);
|
||||
const webinarDate = new Date(data.webinar_date_utc + 'Z');
|
||||
const startTime = webinarDate.toISOString().replace(/-|:|..*Z/g, '') + 'Z';
|
||||
const endTime = new Date(webinarDate.getTime() + (60 * 60 * 1000)).toISOString().replace(/-|:|..*Z/g, '') + 'Z';
|
||||
|
||||
const googleLink = `https://www.google.com/calendar/render?action=TEMPLATE&text=${webinarTitle}&dates=${startTime.replace(/Z$/, '')}/${endTime.replace(/Z$/, '')}&details=Join+the+webinar!`;
|
||||
// Correctly format dates for UTC (YYYYMMDDTHHMMSSZ)
|
||||
const formatUTCDate = (date) => {
|
||||
return date.toISOString().replace(/\.\d{3}Z$/, 'Z').replace(/[-:]/g, '');
|
||||
};
|
||||
|
||||
const startTime = formatUTCDate(webinarDate);
|
||||
const endTime = formatUTCDate(new Date(webinarDate.getTime() + (60 * 60 * 1000)));
|
||||
|
||||
const googleLink = `https://www.google.com/calendar/render?action=TEMPLATE&text=${webinarTitle}&dates=${startTime}/${endTime}&details=Join+the+webinar!&ctz=UTC`;
|
||||
|
||||
const icsContent = [
|
||||
'BEGIN:VCALENDAR',
|
||||
'VERSION:2.0',
|
||||
'BEGIN:VEVENT',
|
||||
`URL:${window.location.href}`,
|
||||
`DTSTART:${startTime.replace(/Z$/, '')}`,
|
||||
`DTEND:${endTime.replace(/Z$/, '')}`,
|
||||
`DTSTART:${startTime}`,
|
||||
`DTEND:${endTime}`,
|
||||
`SUMMARY:${data.webinar_title}`,
|
||||
'DESCRIPTION:Join the webinar!',
|
||||
'END:VEVENT',
|
||||
'END:VCALENDAR'
|
||||
].join('\n');
|
||||
const outlookLink = `data:text/calendar;charset=utf8,${encodeURIComponent(icsContent)}`;
|
||||
const outlookLink = `data:text/calendar;charset=utf-8,${encodeURIComponent(icsContent)}`;
|
||||
|
||||
formResult.innerHTML = `
|
||||
<div class="success-message">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user