diff --git a/public/js/main.js b/public/js/main.js index 396f30a..03fdc83 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -401,15 +401,19 @@ function updateTimerMetrics(netElapsedSeconds) { // Target hours from user selection (default 8) const targetSeconds = targetHours * 60 * 60; - // Calculate total pause time: 30 min after 6h + 15 min after 9h - const pauseDuration30Min = 30 * 60; // 30 minutes in seconds - const pauseDuration15Min = 15 * 60; // 15 minutes in seconds + // Calculate required pause time based on target hours (German law) + let totalPauseSeconds = 0; + if (targetHours > 9) { + // More than 9h -> 45 min pause (30 + 15) + totalPauseSeconds = 45 * 60; + } else if (targetHours > 6) { + // More than 6h -> 30 min pause + totalPauseSeconds = 30 * 60; + } + // 6h or less -> no mandatory pause - // Time needed including pauses - // After 6h work -> 30 min pause - // After 9h work -> 15 min pause - // Total gross time = target work hours + 30min pause + 15min pause - const totalGrossTimeNeeded = targetSeconds + pauseDuration30Min + pauseDuration15Min; + // Total gross time = target work hours + pause time + const totalGrossTimeNeeded = targetSeconds + totalPauseSeconds; // Calculate when target will be reached (clock time) const targetReachedTimestamp = new Date(timerStartTime + totalGrossTimeNeeded * 1000);