Describe the bug
When using eq(…, …) with Date objects, it does a referential comparison rather than a Date#getTime() comparison. A work around is to use eq(concat(date1, ''), concat(date2, '')) but this rounds to the nearest second and discards milliseconds so it's not very good.
Expected behavior
I expected that there would be special support for Date objects, as there is already for UInt8Array and Buffer (areValuesEqual).
Date handling is already supported by gt / get / lt / let comparisons, and also in normalizeValue
|
if (value instanceof Date) { |
Describe the bug
When using
eq(…, …)with Date objects, it does a referential comparison rather than aDate#getTime()comparison. A work around is to useeq(concat(date1, ''), concat(date2, ''))but this rounds to the nearest second and discards milliseconds so it's not very good.Expected behavior
I expected that there would be special support for Date objects, as there is already for
UInt8ArrayandBuffer(areValuesEqual).Date handling is already supported by
gt/get/lt/letcomparisons, and also innormalizeValuedb/packages/db/src/utils/comparison.ts
Line 143 in 7aedf12