@crisp-ui-kit/crisp 0.13.0 → 0.13.1

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.
@@ -62,6 +62,13 @@ const asText = (v) => {
62
62
  return "";
63
63
  if (Array.isArray(v))
64
64
  return v.join(", ");
65
+ // Before the generic object branch, which would look for `.name`, find none
66
+ // and return "" — turning every Date into the empty string (#185). The ISO
67
+ // date is stable and locale-independent, so `contains "2026-06"` works; it
68
+ // will not match "16/06/2026", and a date-aware operator set is Attio's
69
+ // date-picker UI, which has to be measured before it can be built.
70
+ if (v instanceof Date)
71
+ return Number.isNaN(v.getTime()) ? "" : v.toISOString().slice(0, 10);
65
72
  if (typeof v === "object") {
66
73
  const name = v.name;
67
74
  return typeof name === "string" ? name : "";
@@ -104,7 +111,12 @@ function applySorts(rows, sorts, get = (row, key) => row[key]) {
104
111
  const av = get(a, s.key);
105
112
  const bv = get(b, s.key);
106
113
  let d = 0;
107
- if (typeof av === "number" && typeof bv === "number")
114
+ // Dates compare by instant, the way two numbers do. Falling through to
115
+ // text here is what made a date column sort identically ascending and
116
+ // descending — every comparison was "" against "" (#185).
117
+ if (av instanceof Date && bv instanceof Date)
118
+ d = av.getTime() - bv.getTime();
119
+ else if (typeof av === "number" && typeof bv === "number")
108
120
  d = av - bv;
109
121
  else
110
122
  d = asText(av).localeCompare(asText(bv));
@@ -24,6 +24,13 @@ const asText = (v) => {
24
24
  return "";
25
25
  if (Array.isArray(v))
26
26
  return v.join(", ");
27
+ // Before the generic object branch, which would look for `.name`, find none
28
+ // and return "" — turning every Date into the empty string (#185). The ISO
29
+ // date is stable and locale-independent, so `contains "2026-06"` works; it
30
+ // will not match "16/06/2026", and a date-aware operator set is Attio's
31
+ // date-picker UI, which has to be measured before it can be built.
32
+ if (v instanceof Date)
33
+ return Number.isNaN(v.getTime()) ? "" : v.toISOString().slice(0, 10);
27
34
  if (typeof v === "object") {
28
35
  const name = v.name;
29
36
  return typeof name === "string" ? name : "";
@@ -66,7 +73,12 @@ export function applySorts(rows, sorts, get = (row, key) => row[key]) {
66
73
  const av = get(a, s.key);
67
74
  const bv = get(b, s.key);
68
75
  let d = 0;
69
- if (typeof av === "number" && typeof bv === "number")
76
+ // Dates compare by instant, the way two numbers do. Falling through to
77
+ // text here is what made a date column sort identically ascending and
78
+ // descending — every comparison was "" against "" (#185).
79
+ if (av instanceof Date && bv instanceof Date)
80
+ d = av.getTime() - bv.getTime();
81
+ else if (typeof av === "number" && typeof bv === "number")
70
82
  d = av - bv;
71
83
  else
72
84
  d = asText(av).localeCompare(asText(bv));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crisp-ui-kit/crisp",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "A lean React design system, measured pixel-for-pixel from Attio.",
5
5
  "license": "MIT",
6
6
  "type": "module",