Skip to content

Vitest equality checks fail when comparing arrays of dates and times #70

@tomgodber

Description

@tomgodber

Hi,

I love what you've done polyfilling Temporal - I'm working on a new project and have no desire to keep using Dates for it. However I have encountered an odd bug when checking equality of arrays of Temporal objects (recreated in the attached test) which has shaken my confidence a bit...

If I do straight equality checks for two PlainDates, or PlainTimes, or ZonedDateTimes then it all works as expected - if A and B are equal then vitest's expect(a).toEqual(b) passes, if they are different it fails.

However if instead I run expect([a,b]).toEqual([b,a]) it always passes, regardless of whether a and b are the same or different. Not ideal!

temporal.test.txt

Image

This is on node 23.5.0, vitest 3.1.1, temporal 0.30.0, typescript 5.8.2.

Any ideas? I'm not sure if the problem sits inside the library, vitest or somewhere in-between but it certainly isn't the outcome I'd expect!

Thanks,

Tom

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