Fristenrechner (beta)

var fileNameInput = document.getElementById('file-name'); var filingDateInput = document.getElementById('filing-date'); var priorityDateInput = document.getElementById('priority-date'); // Function to add days to a date function addDays(date, days) { var result = new Date(date); result.setDate(result.getDate() + days); return result; } // Function to check if a date is a weekend function isWeekend(date) { var day = date.getDay(); return day == 6 || day == 0; } // Function to calculate the end date function calculateEndDate() { var filingDate = new Date(filingDateInput.value); var periods = [30, 60, 90]; // Add your periods here periods.forEach(function(period) { var endDate = addDays(filingDate, period); // If the end date is a weekend, add days until it's not while(isWeekend(endDate)) { endDate = addDays(endDate, 1); } console.log('End date for period ' + period + ': ' + endDate); }); } // Add an event listener to calculate the end date when the filing date changes filingDateInput.addEventListener('change', calculateEndDate);