Skip to content

eq(…, …) does not work with Date objects #934

@bradleyayers

Description

@bradleyayers
  • I've validated the bug against the latest version of DB packages

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) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions