Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tomgodber opened this issue Apr 3, 2025 · 0 comments
Open

Comments

@tomgodber
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant