import { jsx, Fragment } from "react/jsx-runtime";
import { Badge } from "../../../../Badge/index.js";
/* empty css                          */
const DateSeparator = ({ date, className = "date-separator" }) => {
  const formatDate = (date2) => {
    if (!date2) return "";
    const today = /* @__PURE__ */ new Date();
    const msgDate = new Date(date2);
    const todayOnly = new Date(today.getFullYear(), today.getMonth(), today.getDate());
    const msgOnly = new Date(msgDate.getFullYear(), msgDate.getMonth(), msgDate.getDate());
    const diffDays = (todayOnly - msgOnly) / (1e3 * 60 * 60 * 24);
    if (diffDays === 0) return "Today";
    if (diffDays === 1) return "Yesterday";
    return msgDate.toLocaleDateString("en-US", {
      year: "numeric",
      month: "short",
      day: "numeric"
    });
  };
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
    Badge,
    {
      color: "default",
      label: formatDate(date),
      size: "small",
      variant: "stroke"
    }
  ) }) });
};
export {
  DateSeparator
};
