/**
 * Cuerpo de un documento legal (HTML ya saneado en el servidor con LegalDocumentHtml).
 */
export function LegalDocumentBody({ html }: { html: string }) {
    return (
        <article
            className="text-sm leading-7 text-foreground [&_a]:text-primary [&_a]:underline [&_blockquote]:my-4 [&_blockquote]:border-l-4 [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground [&_h2]:mt-8 [&_h2]:mb-3 [&_h2]:text-2xl [&_h2]:font-semibold [&_h3]:mt-6 [&_h3]:mb-2 [&_h3]:text-xl [&_h3]:font-semibold [&_li]:ml-6 [&_ol]:my-3 [&_ol]:list-decimal [&_p]:my-3 [&_ul]:my-3 [&_ul]:list-disc"
            dangerouslySetInnerHTML={{ __html: html }}
        />
    );
}

export function formatLegalUpdatedAt(value: string | null): string | null {
    if (!value) {
        return null;
    }

    return new Intl.DateTimeFormat('es', {
        day: 'numeric',
        month: 'long',
        year: 'numeric',
    }).format(new Date(value));
}
