---
import type { DateField } from '../../resource-types';
interface Props {
field: DateField;
value: unknown;
}
const { field, value } = Astro.props;
// Coerce ISO datetime → "YYYY-MM-DD" for the control.
function toDateInputValue(v: unknown): string {
if (v == null || v === '') return '';
const s = String(v);
const m = s.match(/^(\d{4}-\d{2}-\d{2})/);
return m ? m[1] : '';
}
const v = toDateInputValue(value);
---