An extension to the chai assertion library that provides a date proximity assertion.
$ npm install chai-date
Use the assertions with chai's expect
or should
assertions.
Asserts that a date is close to another date.
var date1 = new Date(2014, 3, 1, 13, 30, 10)
var date2 = new Date(2014, 3, 1, 13, 30, 40)
date1.should.be.closeToDate(date2, 30, 'seconds')
date1.should.be.closeToDate(date2, 30) // seconds is the default
date1.should.not.be.closeToDate(date2, 20, 'seconds')
Authors James Pike
MIT