import type { Period } from "fhir/r4"; // The report form holds an absent period as blank ends. Blank is not a value to FHIR, and a write // carrying one is refused outright, so only the ends actually filled in are sent. export const filledPeriod = (period?: { start?: string; end?: string } | null): Period | undefined => { const start = period?.start?.trim() || undefined; const end = period?.end?.trim() || undefined; if (!start && !end) return undefined; return { ...(start && { start }), ...(end && { end }) }; };