Skip to content
Source
Sign inSign up
TanStack/db

feat: add support for dates to max and min functions. #428

MergedMAST1999(GitHub profile, opens in a new tab)merged 10 commits intomain fromrefs/pull/428/headmerged by samwillis

Showing 11 changed files with 33 additions and 17 deletions (loading 8).

x
0 of 11 viewed, 11 left
6 additions and 0 deletions.changeset/brave-rocks-lie.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+"@tanstack/db-ivm": patch
+"@tanstack/db": patch
+---
+​
+Add support for Date objects to min/max aggregates and range queries when using an index.
24 additions and 14 deletionspackages/db/src/indexes/btree-index.tsModified
View file
@@ -1,5 +1,5 @@
import { BTree } from "../utils/btree.js"
-import { defaultComparator } from "../utils/comparison.js"
+import { defaultComparator, normalizeValue } from "../utils/comparison.js"
import { BaseIndex } from "./base-index.js"
import type { BasicExpression } from "../query/ir.js"
import type { IndexOperation } from "./base-index.js"
@@ -71,15 +71,18 @@
​
+ // Normalize the value for Map key usage
+ const normalizedValue = normalizeValue(indexedValue)
+​
// Check if this value already exists
- if (this.valueMap.has(indexedValue)) {