feat: Wetter zum gewählten Datum und zur Endzeit übernehmen — Version 1.15.0

Bisher stand im Formular immer der aktuelle Messwert, auch bei nachträglich
erfassten Einträgen. Ändert der Benutzer nun Datum oder Endzeit, werden
Temperatur, Feuchte und Luftdruck auf die Messung zu diesem Zeitpunkt
umgestellt.

/api/wetter nimmt dafür optional ?zeit=YYYY-MM-DDTHH:MM, holt über /range das
Fenster ±20 Minuten und liefert die nächstgelegene Messung. Wichtig: die
Wetter-API deutet Parameter ohne Zeitzone als UTC — die Route rechnet deshalb
Europe/Berlin um, sonst läge das Ergebnis im Sommer zwei Stunden daneben.

Gibt es keine Messung (Zukunft, Ausfall der Station), bleiben die bisherigen
Werte stehen und es erscheint ein Hinweis unter den Feldern.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-08 21:11:17 +02:00
parent 46e0254038
commit 5e37a9427c
5 changed files with 138 additions and 10 deletions
+4
View File
@@ -39,6 +39,10 @@ Saving an `SF` entry also writes back into the Sonderführungs register `SoFue2`
Führungen that fall out never produce a logbuch entry. The **Führungen** tab (`components/Fuehrungen.tsx`, open to every logged-in BEO) lists upcoming `status=2` rows and offers cancel (`status=3`, date kept) and postpone (old `wtermin` saved into the long-unused `verlegt` column, new date written). Both append a dated line with the user's Kürzel to `bemerkung` rather than replacing it. Backed by `LB_SOFUE_TERMINE` / `LB_SOFUE_ABSAGEN` / `LB_SOFUE_VERSCHIEBEN` in `DB4js_all.php` and the routes under `app/api/sofue/`.
## Weather
`app/api/wetter/route.ts` proxies `stwwetter.fuerst-stuttgart.de/api/weather`. Without params it returns `/latest`; with `?zeit=YYYY-MM-DDTHH:MM` (local time) it queries `/range` ±20 min around that moment and returns the closest reading, or 404 when the station has nothing (future dates, outages). **The weather API treats naive query params as UTC**, so the route converts Europe/Berlin → UTC via `Intl` offsets — without that, summer readings are off by two hours. `LogbuchForm` refetches whenever `ende` changes (date or Endzeit), skipping the first run so an edited entry keeps its stored values.
## Documentation
`ANLEITUNG.md` is the single source for the user manual — edit only this file. `public/anleitung.html` (linked from the app footer) is **generated** by `scripts/build-anleitung.mjs` and is untracked (`.gitignore`); never hand-edit it. `npm run anleitung` builds it; a `prebuild` hook runs the same script before every `next build`, so the Docker image always gets a current copy (`.dockerignore` excludes `*.md` but re-includes `ANLEITUNG.md` for exactly this).