@open-mercato/ui 0.7.1-develop.7153.1.7145d295e6 → 0.7.1-develop.7170.1.d95074d7ba

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.
@@ -40,10 +40,11 @@ import { raiseCrudError } from "./utils/serverErrors.js";
40
40
  import { computeMenuViewportShiftX } from "./utils/viewport.js";
41
41
  import { PerspectiveSidebar } from "./PerspectiveSidebar.js";
42
42
  import { Popover, PopoverTrigger, PopoverContent } from "../primitives/popover.js";
43
- import { formatWithPublicDateFormat, normalizeDateFormatPattern } from "../primitives/date-format.js";
43
+ import { parseISO } from "date-fns/parseISO";
44
+ import { formatDisplayDateTime } from "../primitives/date-format.js";
44
45
  import { cn } from "@open-mercato/shared/lib/utils";
45
46
  import { readVersionedPreference, writeVersionedPreference, clearVersionedPreference } from "@open-mercato/shared/lib/browser/versionedPreference";
46
- import { useT } from "@open-mercato/shared/lib/i18n/context";
47
+ import { useT, useLocale } from "@open-mercato/shared/lib/i18n/context";
47
48
  import { flash } from "./FlashMessages.js";
48
49
  import { useConfirmDialog } from "./confirm-dialog/index.js";
49
50
  import { surfaceRecordConflict } from "./conflicts/index.js";
@@ -1105,7 +1106,7 @@ function DataTable({
1105
1106
  }
1106
1107
  return /* @__PURE__ */ jsx(RowActions, { items: injectedItems });
1107
1108
  }, [injectedRowActions, rowActions, router, t]);
1108
- const DATE_FORMAT = normalizeDateFormatPattern(process.env.NEXT_PUBLIC_OM_DATE_TIME_FORMAT) ?? normalizeDateFormatPattern(process.env.NEXT_PUBLIC_DATE_TIME_FORMAT) ?? normalizeDateFormatPattern(process.env.NEXT_PUBLIC_OM_DATE_FORMAT) ?? normalizeDateFormatPattern(process.env.NEXT_PUBLIC_DATE_FORMAT) ?? "yyyy-MM-dd HH:mm";
1109
+ const dateLocale = useLocale();
1109
1110
  const tryParseDate = (v) => {
1110
1111
  if (v == null) return null;
1111
1112
  if (v instanceof Date) return isNaN(v.getTime()) ? null : v;
@@ -1117,7 +1118,7 @@ function DataTable({
1117
1118
  const s = v.trim();
1118
1119
  if (!s) return null;
1119
1120
  if (/^\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/.test(s)) {
1120
- const d2 = new Date(s);
1121
+ const d2 = parseISO(s);
1121
1122
  return isNaN(d2.getTime()) ? null : d2;
1122
1123
  }
1123
1124
  const d = new Date(s);
@@ -2610,7 +2611,7 @@ function DataTable({
2610
2611
  if (isDateCol) {
2611
2612
  const raw = cell.getValue();
2612
2613
  const d = tryParseDate(raw);
2613
- content = d ? formatWithPublicDateFormat(d, DATE_FORMAT) ?? raw : raw;
2614
+ content = d ? formatDisplayDateTime(d, dateLocale) ?? raw : raw;
2614
2615
  } else {
2615
2616
  content = flexRender(cell.column.columnDef.cell, cell.getContext());
2616
2617
  }
@@ -2625,7 +2626,7 @@ function DataTable({
2625
2626
  tooltipText = metaTooltipContent(row.original);
2626
2627
  } else if (isDateCol && cellValue != null) {
2627
2628
  const parsedDate = tryParseDate(cellValue);
2628
- tooltipText = parsedDate ? formatWithPublicDateFormat(parsedDate, DATE_FORMAT) ?? String(cellValue) : String(cellValue);
2629
+ tooltipText = parsedDate ? formatDisplayDateTime(parsedDate, dateLocale) ?? String(cellValue) : String(cellValue);
2629
2630
  } else {
2630
2631
  tooltipText = cellValue != null ? String(cellValue) : void 0;
2631
2632
  }