Datumsformat konfigurierbar (Einstellungen -> Darstellung)

MHD wurde in den Ansichten noch roh als YYYY-MM-DD ausgegeben. Jetzt:
- Neue Einstellung date_format (23.12.2026 | 23.12.26 | 23. Dezember 2026 |
  2026-12-23 | 12/23/2026) mit Live-Beispiel auf der Einstellungsseite.
- SettingsProvider stellt Format und formatDate() app-weit bereit und laedt die
  Einstellungen nach dem Login.
- Verwendet in Uebersicht (bald ablaufend), Produktdetail (Chargen) und
  Auslagern (Chargenauswahl). Datumsfelder zur Eingabe bleiben ISO, wie es das
  HTML-Datumsfeld verlangt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-22 15:04:01 +02:00
parent 4bb9a10366
commit 93e487a1b0
7 changed files with 112 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import { useAuth } from "../auth";
import BarcodeList from "../components/BarcodeList";
import Icon from "../components/Icon";
import { guessGroup } from "../offUtils";
import { useSettings } from "../settings";
import { daysUntil, expiryRowClass, fmt, isExpired, relativeExpiry, unitShort } from "../units";
const EMPTY = {
@@ -377,6 +378,7 @@ export default function ProductForm() {
/** Chargen-Karte mit Bearbeiten/Löschen. Bearbeitet wird in der Produkteinheit. */
function LotsCard({ product, lots, baseShort, warnDays, isAdmin, imageUrl, onChanged, onError }) {
const { formatDate } = useSettings();
const [editId, setEditId] = useState(null);
const [draft, setDraft] = useState({ quantity: "", best_before: "" });
// In welcher Einheit die Menge bearbeitet wird: "unit" oder "package".
@@ -501,7 +503,7 @@ function LotsCard({ product, lots, baseShort, warnDays, isAdmin, imageUrl, onCha
style={{ marginTop: 0, minWidth: 150 }} />
) : (
<>
{l.best_before || ""}
{l.best_before ? formatDate(l.best_before) : ""}
{cls && (
<span className={`badge ${cls === "row-danger" ? "danger" : "warn"}`}
style={{ marginLeft: 6 }}>