I\'m using moment.js for date/time in my application, but it seems like it doesn\'t play well with Jasmine\'s mocking capabilities. I\'ve put together a test suite below that sh
I was trying to find an alternative to jasmine
or even other mock frameworks to avoid dependencies.
const currentToday = moment().toDate();
console.log(`currentToday:`, currentToday)
const newToday = moment('1980-01-01').toDate();
console.log(`newToday :`, newToday);
Date.now = () => {
return newToday
};
const fakedToday = moment().toDate();
console.log(`fakedToday :`, fakedToday)
currentToday: 2019-09-17T15:26:12.763Z
newToday : 1980-01-01T00:00:00.000Z
fakedToday : 1980-01-01T00:00:00.001Z