Menstrual Cycle Tracker
Log and visualize your cycle to understand your body's rhythm.
Log a Period
Your Stats
Period
Predicted Period
Fertile Window
Log at least two periods to see your stats and predictions.
'; } } function addSampleData() { const today = new Date("2025-08-02T14:14:00+06:00"); periods = [ { startDate: new Date(new Date(today).setMonth(today.getMonth() - 3, 5)), endDate: new Date(new Date(today).setMonth(today.getMonth() - 3, 9)) }, { startDate: new Date(new Date(today).setMonth(today.getMonth() - 2, 3)), endDate: new Date(new Date(today).setMonth(today.getMonth() - 2, 8)) }, { startDate: new Date(new Date(today).setMonth(today.getMonth() - 1, 1)), endDate: new Date(new Date(today).setMonth(today.getMonth() - 1, 5)) }, ]; } // --- PDF DOWNLOAD LOGIC --- async function downloadPDF() { pdfLoader.classList.remove('hidden'); pdfDownloadBtn.disabled = true; const { jsPDF } = window.jspdf; const pdfExportContent = document.getElementById('pdf-export-area'); let periodHistoryHtml = periods.map(p => `Menstrual Cycle Report
Generated on: ${new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
Avg. Period Duration
${window.cycleStats.avgPeriodDuration} days
Avg. Cycle Length
${window.cycleStats.avgCycleLength} days
Next Predicted Period Starts
${window.cycleStats.nextPeriodStartDate.toLocaleDateString()}
Cycle History
| Start Date | End Date | Duration | Cycle Length |
|---|
