Files
datecalc/templates/index.html

250 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% macro format_date(date_str) %}
{%- if date_str and '-' in date_str and date_str|length == 10 -%}
{{ date_str[8:10] }}.{{ date_str[5:7] }}.{{ date_str[0:4] }}
{%- else -%}
{{ date_str }}
{%- endif -%}
{% endmacro %}
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Elpatrons Datumsrechner Open Source Kalender- und Datumsberechnungen</title>
<meta name="description" content="Elpatrons Datumsrechner: Open Source Web-App für Kalender- und Datumsberechnungen. Tage, Werktage, Wochen, Monate, Kalenderwochen, Wochentage und mehr berechnen werbefrei, trackingfrei, kostenlos.">
<meta name="keywords" content="Datum, Kalender, Datumsrechner, Werktage, Tage zählen, Kalenderwoche, Wochentag, Open Source, Python, Flask, kostenlos, werbefrei, trackingfrei, cookiefrei">
<meta property="og:title" content="Elpatrons Datumsrechner Open Source Kalender- und Datumsberechnungen">
<meta property="og:description" content="Open Source Web-App für Kalender- und Datumsberechnungen. Werbefrei, trackingfrei, kostenlos.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://codeberg.org/elpatron/datecalc">
<meta property="og:image" content="/logo.svg">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="/static/style.css">
<script>
function setToday(id) {
const today = new Date().toISOString().split('T')[0];
document.getElementById(id).value = today;
}
function openAccordion(idx) {
document.querySelectorAll('.accordion-header').forEach((btn, i) => {
btn.classList.toggle('active', i === idx);
});
document.querySelectorAll('.accordion-content').forEach((el, i) => {
el.classList.toggle('active', i === idx);
});
}
document.addEventListener('DOMContentLoaded', function() {
openAccordion(parseInt("{{ active_idx|default(0) }}"));
});
</script>
</head>
<body>
<div class="container">
<h1>Elpatrons Datumsrechner</h1>
<div class="accordion">
<div class="accordion-item">
<button type="button" class="accordion-header header-tage" onclick="openAccordion(0)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit Doppelpfeil -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><path d="M8 15h8M8 15l2-2M8 15l2 2M16 15l-2-2M16 15l-2 2" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round"/></svg>
</span>
Anzahl der Tage zwischen zwei Daten
</button>
<div class="accordion-content">
<form method="post">
<label>Startdatum:<br>
<span class="date-row">
<input type="date" name="start1" id="start1">
<button type="button" class="today-btn" onclick="setToday('start1')">Heute</button>
</span>
</label>
<label>Enddatum:<br>
<span class="date-row">
<input type="date" name="end1" id="end1">
<button type="button" class="today-btn" onclick="setToday('end1')">Heute</button>
</span>
</label>
<button name="action" value="tage" type="submit">Berechnen</button>
</form>
{% if tage is not none %}
<div class="result">Anzahl der Tage zwischen <b>{{ format_date(request.form.get('start1', '')) }}</b> und <b>{{ format_date(request.form.get('end1', '')) }}</b>: {{ tage }}</div>
{% endif %}
</div>
</div>
<div class="accordion-item">
<button type="button" class="accordion-header header-werktage" onclick="openAccordion(1)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit Mo-Fr Symbol -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><text x="12" y="17" text-anchor="middle" font-size="8" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">Mo-Fr</text></svg>
</span>
Anzahl der Werktage zwischen zwei Daten
</button>
<div class="accordion-content">
<form method="post">
<label>Startdatum:<br>
<span class="date-row">
<input type="date" name="start2" id="start2">
<button type="button" class="today-btn" onclick="setToday('start2')">Heute</button>
</span>
</label>
<label>Enddatum:<br>
<span class="date-row">
<input type="date" name="end2" id="end2">
<button type="button" class="today-btn" onclick="setToday('end2')">Heute</button>
</span>
</label>
<button name="action" value="werktage" type="submit">Berechnen</button>
</form>
{% if werktage is not none %}
<div class="result">Anzahl der Werktage zwischen <b>{{ format_date(request.form.get('start2', '')) }}</b> und <b>{{ format_date(request.form.get('end2', '')) }}</b>: {{ werktage }}</div>
{% endif %}
</div>
</div>
<div class="accordion-item">
<button type="button" class="accordion-header header-wochentag" onclick="openAccordion(2)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit W -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><text x="12" y="17" text-anchor="middle" font-size="12" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">W</text></svg>
</span>
Wochentag eines Datums
</button>
<div class="accordion-content">
<form method="post">
<label>Datum:<br>
<span class="date-row">
<input type="date" name="datum3" id="datum3">
<button type="button" class="today-btn" onclick="setToday('datum3')">Heute</button>
</span>
</label>
<button name="action" value="wochentag" type="submit">Anzeigen</button>
</form>
{% if wochentag is not none %}
<div class="result">Wochentag von <b>{{ format_date(request.form.get('datum3', '')) }}</b>: {{ wochentag }}</div>
{% endif %}
</div>
</div>
<div class="accordion-item">
<button type="button" class="accordion-header header-plusminus-tage" onclick="openAccordion(3)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit ± -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><text x="12" y="17" text-anchor="middle" font-size="16" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">±</text></svg>
</span>
Datum plus/minus X Tage
</button>
<div class="accordion-content">
<form method="post">
<label>Datum:<br>
<span class="date-row">
<input type="date" name="datum4" id="datum4">
<button type="button" class="today-btn" onclick="setToday('datum4')">Heute</button>
</span>
</label>
<label>Anzahl Tage:<br>
<input type="number" name="tage4" id="tage4" style="width: 6em;">
</label>
<span class="date-calc-row">
<label><input type="radio" name="richtung4" value="add" checked> addieren</label>
<label><input type="radio" name="richtung4" value="sub"> subtrahieren</label>
</span>
<button name="action" value="datumsrechnung" type="submit">Berechnen</button>
</form>
{% if datumsrechnung is not none %}
<div class="result">Datum <b>{{ format_date(request.form.get('datum4', '')) }}</b> {{ 'plus' if request.form.get('richtung4') == 'add' else 'minus' }} <b>{{ request.form.get('tage4', '') }}</b> Tage: {{ datumsrechnung }}</div>
{% endif %}
</div>
</div>
<div class="accordion-item">
<button type="button" class="accordion-header header-plusminus-werktage" onclick="openAccordion(4)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit ± und Mo-Fr -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><text x="12" y="14" text-anchor="middle" font-size="10" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">±</text><text x="12" y="20" text-anchor="middle" font-size="7" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">Mo-Fr</text></svg>
</span>
Datum plus/minus X Werktage
</button>
<div class="accordion-content">
<form method="post">
<label>Datum:<br>
<span class="date-row">
<input type="date" name="datum5" id="datum5">
<button type="button" class="today-btn" onclick="setToday('datum5')">Heute</button>
</span>
</label>
<label>Anzahl Werktage:<br>
<input type="number" name="tage5" id="tage5" style="width: 6em;">
</label>
<span class="date-calc-row">
<label><input type="radio" name="richtung5" value="add" checked> addieren</label>
<label><input type="radio" name="richtung5" value="sub"> subtrahieren</label>
</span>
<button name="action" value="werktagsrechnung" type="submit">Berechnen</button>
</form>
{% if werktagsrechnung is not none %}
<div class="result">Datum <b>{{ format_date(request.form.get('datum5', '')) }}</b> {{ 'plus' if request.form.get('richtung5') == 'add' else 'minus' }} <b>{{ request.form.get('tage5', '') }}</b> Werktage: {{ werktagsrechnung }}</div>
{% endif %}
</div>
</div>
<div class="accordion-item">
<button type="button" class="accordion-header header-plusminus-wochenmonate" onclick="openAccordion(5)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit ± und W/M -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><text x="12" y="14" text-anchor="middle" font-size="10" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">±</text><text x="12" y="20" text-anchor="middle" font-size="7" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">W/M</text></svg>
</span>
Datum plus/minus X Wochen/Monate
</button>
<div class="accordion-content">
<form method="post">
<label>Datum:<br>
<span class="date-row">
<input type="date" name="datum8" id="datum8">
<button type="button" class="today-btn" onclick="setToday('datum8')">Heute</button>
</span>
</label>
<label>Anzahl:<br>
<input type="number" name="anzahl8" id="anzahl8" style="width: 6em;">
</label>
<span class="date-calc-row">
<label><input type="radio" name="einheit8" value="wochen" checked> Wochen</label>
<label><input type="radio" name="einheit8" value="monate"> Monate</label>
</span>
<span class="date-calc-row">
<label><input type="radio" name="richtung8" value="add" checked> addieren</label>
<label><input type="radio" name="richtung8" value="sub"> subtrahieren</label>
</span>
<button name="action" value="wochen_monate" type="submit">Berechnen</button>
</form>
{% if wochen_monate is not none %}
<div class="result">Datum <b>{{ format_date(request.form.get('datum8', '')) }}</b> {{ 'plus' if request.form.get('richtung8') == 'add' else 'minus' }} <b>{{ request.form.get('anzahl8', '') }}</b> {{ 'Wochen' if request.form.get('einheit8') == 'wochen' else 'Monate' }}: {{ wochen_monate }}</div>
{% endif %}
</div>
</div>
<div class="accordion-item">
<button type="button" class="accordion-header header-kw" onclick="openAccordion(6)">
<span style="vertical-align:middle;display:inline-block;width:1.5em;">
<!-- Kalender mit Pfeil nach außen -->
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="5" width="18" height="16" rx="4" fill="#fff" stroke="#2563eb" stroke-width="2"/><rect x="3" y="5" width="18" height="4" rx="2" fill="#2563eb"/><rect x="6" y="2" width="2" height="4" rx="1" fill="#2563eb"/><rect x="16" y="2" width="2" height="4" rx="1" fill="#2563eb"/><path d="M7 17l5-5 5 5" stroke="#2563eb" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><text x="12" y="12" text-anchor="middle" font-size="8" font-family="Segoe UI, Arial, sans-serif" fill="#2563eb" font-weight="bold">KW</text></svg>
</span>
Start-/Enddatum zu Kalenderwoche
</button>
<div class="accordion-content">
<form method="post">
<label>Jahr:<br>
<input type="number" name="jahr7" id="jahr7" min="1900" max="2100" style="width: 7em;">
</label>
<label>Kalenderwoche:<br>
<input type="number" name="kw7" id="kw7" min="1" max="53" style="width: 5em;">
</label>
<button name="action" value="kw_datum" type="submit">Start-/Enddatum berechnen</button>
</form>
{% if kw_datum is not none %}
<div class="result">Start-/Enddatum der KW <b>{{ request.form.get('kw7', '') }}</b> im Jahr <b>{{ request.form.get('jahr7', '') }}</b>: {{ kw_datum }}</div>
{% endif %}
</div>
</div>
</div>
</div>
<footer style="text-align:center; margin-top:2em; color:#64748b; font-size:0.98em; padding-bottom:1.5em;">
Dies ist ein werbe- und trackingfreier <a href="https://codeberg.org/elpatron/datecalc" target="_blank" style="color:#2563eb; text-decoration:underline;">Open Source Datumsrechner</a><br>
© 2025 M. Busche
</footer>
</body>
</html>