"use client"; import { P1_COMMON_UI } from "@/lib/priority1/ui-labels"; import { p1DateFromIso, p1DateToIso } from "@/lib/priority1/date-format"; import { minPickupDateIso } from "@/lib/priority1/pickup-date"; import { P1FieldLabel } from "@/components/priority1/feathery-card"; interface P1DateFieldProps { label: string; /** MM/DD/YYYY */ value: string; disabled?: boolean; error?: string; onChange: (displayValue: string) => void; } /** 提货日 — 原生日历 + MM/DD/YYYY 存储 */ export function P1DateField({ label, value, disabled, error, onChange, }: P1DateFieldProps) { const iso = p1DateToIso(value); const minIso = minPickupDateIso(); return (
{label} { const next = p1DateFromIso(e.target.value); if (next) onChange(next); }} className={`h-11 w-full max-w-xs rounded-sm border bg-neutral-100 px-3 text-sm focus:border-neutral-600 focus:outline-none focus:ring-1 focus:ring-neutral-400 disabled:opacity-60 ${ error ? "border-red-500" : "border-neutral-400" }`} /> {value ? (

已选:{value}

) : (

{P1_COMMON_UI.pickupDateHint}

)} {error ?

{error}

: null}
); }