stackbuilders/assertive-ts

DateAssertion.toMatchDateParts not working when using month literals

Closed this issue ยท 2 comments

DateAssertion.toMatchDateParts supports passing the month as a string literal (e.g. "january"). When doing this, the matcher does not work correctly. See, for example:

const myDate = new Date(2021, 1, 1); // February 1st, 2021

expect(myDate).toMatchDateParts({ month: "february" });

This results in: Expected <2021-02-01T17:10:15.025Z> to be equal to <2022-02-12T02:59:59.727Z>

The issue seems to be that toMatchDateParts is comparing "february" === optionsAsDate.getMonth().

A similar issue is happening when using dayOfWeek literals.

๐ŸŽ‰ This issue has been resolved in version 1.3.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

๐ŸŽ‰ This issue has been resolved in version 1.0.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€