These assertions test Date objects and time-related values.
Aliases:
to be a date
,to be a Date
Success:
expect(new Date(), 'to be a date');
expect(new Date('2024-01-01'), 'to be a Date');
expect(new Date(Date.now()), 'to be a date');
Failure:
expect('2024-01-01', 'to be a date');
// AssertionError: Expected '2024-01-01' to be a date
expect(1704067200000, 'to be a Date'); // Unix timestamp
Negation:
expect('2024-01-01', 'not to be a date');
expect(1704067200000, 'not to be a Date');