Menstrual Cycle Tracker

Menstrual Cycle Tracker

Log and visualize your cycle to understand your body's rhythm.

Log a Period

Your Stats

Period
Predicted Period
Fertile Window

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

${periodHistoryHtml}
Start DateEnd DateDurationCycle Length
`; await new Promise(resolve => setTimeout(resolve, 100)); try { const canvas = await html2canvas(pdfExportContent, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: "portrait", unit: "pt", format: "a4" }); const pageWidth = pdf.internal.pageSize.getWidth(); const margin = 40; const imgProps = pdf.getImageProperties(imgData); const pdfImageWidth = pageWidth - (margin * 2); const pdfImageHeight = (imgProps.height * pdfImageWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', margin, margin, pdfImageWidth, pdfImageHeight); pdf.save(`Menstrual-Cycle-Report-${new Date().toISOString().slice(0,10)}.pdf`); } catch (error) { console.error("Error generating PDF:", error); alert("Sorry, there was an error creating the PDF."); } finally { pdfLoader.classList.add('hidden'); pdfDownloadBtn.disabled = false; pdfExportContent.innerHTML = ''; } } // --- START THE APP --- initialize(); });
Scroll to Top