to be same or before

  • <moment> [not] to be same or before <moment|string|number|date|array|object>

Passes if the moment instance represents a time at or before the specified time.

expect(moment(), 'to be same or before', moment().add(1, 'hour'));

It supports any value supported by moment#isAfter

When the assertion fails you'll get this output:

expect(moment('2015-04-01'), 'to be same or before', moment('2015-01-01'));
expected moment('2015-04-01T00:00:00.000+02:00')
to be same or before moment('2015-01-01T00:00:00.000+01:00')