Date Difference Calculator
The end date is before the start date. Please choose correct order.
`; } else { message = `Both dates are the same.
`; } document.getElementById('resultOutput').innerHTML = message; openTab('resultTab'); } window.calculateDateDifference = calculateDateDifference; function downloadPDF() { const resultDiv = document.getElementById('resultOutput'); if (!resultDiv || !resultDiv.innerText.trim()) { alert("Please calculate the date difference first."); return; } const doc = new jsPDF(); doc.setFontSize(18); doc.text('Date Difference Result', 14, 20); doc.setFontSize(12); const lines = resultDiv.innerText.split('\n'); let y = 35; lines.forEach(line => { if (line.trim()) { doc.text(line.trim(), 14, y); y += 10; } }); doc.save('Date_Difference_Result.pdf'); } window.downloadPDF = downloadPDF; });