UNPKG

plazbot

Version:

Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.

29 lines (28 loc) 1.35 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { usePlazbotContext } from '../../context/PlazbotContext'; function formatDate(date) { const now = new Date(); const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); const target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); const diffDays = Math.floor((today.getTime() - target.getTime()) / 86400000); if (diffDays === 0) return 'Hoy'; if (diffDays === 1) return 'Ayer'; return date.toLocaleDateString('es', { day: 'numeric', month: 'long', year: 'numeric' }); } export function DateSeparator({ date, style }) { const { theme } = usePlazbotContext(); return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '12px', margin: '12px 0', ...style, }, children: [_jsx("div", { style: { flex: 1, height: '1px', backgroundColor: theme.borderColor } }), _jsx("span", { style: { fontSize: theme.fontSizeSm, color: theme.textSecondary, fontFamily: theme.fontFamily, whiteSpace: 'nowrap', }, children: formatDate(date) }), _jsx("div", { style: { flex: 1, height: '1px', backgroundColor: theme.borderColor } })] })); }