diff --git a/components/orgchart/AsOfPicker.tsx b/components/orgchart/AsOfPicker.tsx
index 4e6e935..7dc2aab 100644
--- a/components/orgchart/AsOfPicker.tsx
+++ b/components/orgchart/AsOfPicker.tsx
@@ -2,9 +2,8 @@
import { CalendarClock } from "lucide-react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
-import { useState } from "react";
import { Button } from "@/components/ui/Button";
-import { DATUM_MAX, DATUM_MIN, FILTER_SELECT_CLASS, istMeldbaresDatum } from "@/components/ui/Field";
+import { FILTER_SELECT_CLASS, KalenderKnopf, useDatumEingabe } from "@/components/ui/Field";
import { fmtDate } from "@/lib/format";
type AsOfPickerProps = {
@@ -28,13 +27,9 @@ export function AsOfPicker({ asOf, today, projectedCount, historyStartsAt }: AsO
router.push(sp.size > 0 ? `${pathname}?${sp}` : pathname, { scroll: false });
}
- // Angeglichen während des Renderns, nicht in einem Effekt — siehe DateField.
- const [entwurf, setEntwurf] = useState(asOf);
- const [zuletzt, setZuletzt] = useState(asOf);
- if (asOf !== zuletzt) {
- setZuletzt(asOf);
- setEntwurf(asOf);
- }
+ // Dieselben Regeln wie in DateField: TT.MM.JJJJ, gemeldet wird nur ein
+ // vollständiges Datum. Hier ist jede Meldung eine Navigation.
+ const datum = useDatumEingabe({ value: asOf, onChange: (d) => setAsOf(d || undefined) });
const isToday = asOf === today;
const isFuture = asOf > today;
@@ -50,27 +45,27 @@ export function AsOfPicker({ asOf, today, projectedCount, historyStartsAt }: AsO
Stichtag
- {/* Der Tippstand bleibt hier, gemeldet wird nur ein vollständiges
- Datum: jede Änderung ist eine Navigation, und beim Tippen der
- Jahreszahl entstehen unterwegs 0002, 0020 und 0202 — jede davon
- lüde die Seite neu und setzte das Feld mitten im Tippen zurück.
- Dieselbe Regel wie in DateField, dort steht auch der lange Grund. */}
- {
- const wert = e.target.value;
- setEntwurf(wert);
- if (istMeldbaresDatum(wert) && wert !== asOf) setAsOf(wert || undefined);
- }}
- onBlur={() => {
- if (entwurf !== asOf && istMeldbaresDatum(entwurf)) setAsOf(entwurf || undefined);
- }}
- className={FILTER_SELECT_CLASS}
- />
+
+ datum.tippen(e.target.value)}
+ onBlur={datum.verlassenFeld}
+ className={`${FILTER_SELECT_CLASS} w-36 pr-9 tabular-nums ${datum.fehler ? "border-danger-solid" : ""}`}
+ />
+
+
+ {datum.fehler && (
+
+ {datum.fehler}
+
+ )}
{!isToday && (