Online Multi-Time Zone Meeting Planner
1. Meeting Details
Available Meeting Times
Please fill in the details and click "Find Available Times" to see results.
No overlapping times found within the specified work hours. Try adjusting the date or work hours.
'; pdfButtonContainer.classList.add('hidden'); lastResults = null; return; } resultsPlaceholder.classList.add('hidden'); pdfButtonContainer.classList.remove('hidden'); lastResults = { slots, timezones, date }; slots.forEach((utcStartMinutes, index) => { const resultDiv = document.createElement('div'); resultDiv.className = 'result-item border rounded-lg p-4'; let headerHTML = `Option ${index + 1}
`;
timezones.forEach(tz => {
const localTime = new Date(`${date}T00:00:00.000Z`);
localTime.setUTCHours(0, utcStartMinutes, 0, 0);
const timeString = localTime.toLocaleTimeString('en-US', {
timeZone: tz,
hour: '2-digit',
minute: '2-digit',
hour12: true
});
const dateString = localTime.toLocaleDateString('en-US', {
timeZone: tz,
weekday: 'short',
month: 'short',
day: 'numeric'
});
headerHTML += `
`;
});
resultDiv.innerHTML = headerHTML + '
';
resultsContainer.appendChild(resultDiv);
});
}
// --- PDF DOWNLOAD ---
window.downloadPDF = function() {
if (!lastResults) return;
const { jsPDF } = window.jspdf;
const doc = new jsPDF('p', 'pt', 'a4');
const { slots, timezones, date } = lastResults;
const duration = document.getElementById('meetingDuration').value;
const pageWidth = doc.internal.pageSize.getWidth();
const pageHeight = doc.internal.pageSize.getHeight();
doc.setFillColor(41, 128, 185);
doc.rect(0, 0, pageWidth, 60, 'F');
doc.setFontSize(20); doc.setTextColor(255); doc.setFont('helvetica', 'bold');
doc.text('Suggested Meeting Times', 30, 38);
doc.setFontSize(10); doc.setFont('helvetica', 'normal'); doc.setTextColor(50);
doc.text(`Meeting Date: ${new Date(date + 'T12:00:00').toLocaleDateString('en-US', { dateStyle: 'long' })}`, 30, 90);
doc.text(`Meeting Duration: ${duration} minutes`, 30, 105);
const tableHead = [timezones.map(tz => tz.split('/').pop().replace(/_/g, ' '))];
const tableBody = slots.map(utcStartMinutes => {
return timezones.map(tz => {
const localTime = new Date(`${date}T00:00:00.000Z`);
localTime.setUTCHours(0, utcStartMinutes, 0, 0);
return localTime.toLocaleTimeString('en-US', { timeZone: tz, hour: '2-digit', minute: '2-digit', hour12: true });
});
});
doc.autoTable({
head: tableHead,
body: tableBody,
startY: 130,
theme: 'grid',
headStyles: { fillColor: [41, 128, 185] },
});
const pageCount = doc.internal.getNumberOfPages();
for(let i = 1; i <= pageCount; i++) {
doc.setPage(i);
doc.setFontSize(8); doc.setTextColor(150);
doc.text(`Page ${i} of ${pageCount}`, pageWidth / 2, pageHeight - 20, { align: 'center' });
}
doc.save('Meeting_Times.pdf');
};
// --- EVENT LISTENERS ---
addLocationBtn.addEventListener('click', addLocation);
// --- INITIALIZE ---
initializeApp();
});
${timeString}
${tz.split('/').pop().replace(/_/g, ' ')}
${dateString}
