@eqtylab/equality 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3289,6 +3289,10 @@ var RELATIVE_DIVISIONS = [
3289
3289
  { amount: Number.POSITIVE_INFINITY, unit: "year" }
3290
3290
  ];
3291
3291
  var LIVE_INTERVAL_MS = 3e4;
3292
+ var NO_DATE_PLACEHOLDER = "---";
3293
+ function isMissing(value) {
3294
+ return value == null || typeof value === "string" && value.trim() === "";
3295
+ }
3292
3296
  function toDate(value) {
3293
3297
  const date = value instanceof Date ? value : new Date(value);
3294
3298
  return Number.isNaN(date.getTime()) ? null : date;
@@ -3319,7 +3323,8 @@ function FormatDate({
3319
3323
  className,
3320
3324
  ...props
3321
3325
  }) {
3322
- const parsed = React16__namespace.useMemo(() => toDate(date), [date]);
3326
+ const missing = isMissing(date);
3327
+ const parsed = React16__namespace.useMemo(() => isMissing(date) ? null : toDate(date), [date]);
3323
3328
  const [now, setNow] = React16__namespace.useState(() => /* @__PURE__ */ new Date());
3324
3329
  const [mounted, setMounted] = React16__namespace.useState(false);
3325
3330
  const isRelative = displayAs === "relative";
@@ -3329,8 +3334,11 @@ function FormatDate({
3329
3334
  const id = setInterval(() => setNow(/* @__PURE__ */ new Date()), LIVE_INTERVAL_MS);
3330
3335
  return () => clearInterval(id);
3331
3336
  }, [isRelative, live]);
3337
+ if (missing) {
3338
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(styles56__default.default["format-date"], className), "aria-label": "No date", ...props, children: NO_DATE_PLACEHOLDER });
3339
+ }
3332
3340
  if (!parsed) {
3333
- return /* @__PURE__ */ jsxRuntime.jsx("time", { className: cn(styles56__default.default["format-date"], className), ...props, children: "Invalid date" });
3341
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(styles56__default.default["format-date"], className), ...props, children: "Invalid date" });
3334
3342
  }
3335
3343
  const machineValue = parsed.toISOString();
3336
3344
  const absolute = formatAbsolute(