The current date can also be mocked with the Jasmine Clock. If you don't give mockDate a base time, it will use the current date.
describe("Mocking the Date object", function(){
it("mocks the Date object and sets to time", function() {
var baseTime = new Date(2021, 9, 25);
¶
If you do not provide a base time to mockDate it will use the current date.
jasmine.clock().mockDate(baseTime);
jasmine.clock().tick(50);
expect(new Date().getTime()).toEqual(baseTime.getTime() + 50);
});
});
});