schummar-table 1.0.4 → 1.0.5

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.js CHANGED
@@ -2273,9 +2273,18 @@ function DateFilterComponent({ value = null, onChange, close, options: { locale,
2273
2273
  })
2274
2274
  });
2275
2275
  }
2276
+ /** Like dateIntersect, but compares the exact times instead of whole days. */
2277
+ function timeIntersect(range, x) {
2278
+ if (!x) return false;
2279
+ const { min, max } = x instanceof Date ? {
2280
+ min: x,
2281
+ max: x
2282
+ } : x;
2283
+ return !(range.max < min || range.min > max);
2284
+ }
2276
2285
  const dateFilter = defineFilter({
2277
2286
  isActive: (value) => !!value,
2278
- test: (value, input) => toSingles(input).some((x) => dateIntersect(value, toDate(x))),
2287
+ test: (value, input, { showTime }) => toSingles(input).some((x) => showTime && value && !(value instanceof Date) ? timeIntersect(value, toDate(x)) : dateIntersect(value, toDate(x))),
2279
2288
  Component: DateFilterComponent
2280
2289
  });
2281
2290
  //#endregion