title: Using jasmie .toHaveBeenCalledWith() function with Moment Objects
body: <p>I have the following test in a angular (4) -</p>
  
  <pre><code> it('should call service',
      async(inject([CommentTableComponent], (cmp: CommentTableComponent) =&gt; {
        spyOn(mockSock, 'getComments').and.callThrough();
        cmp.ngOnInit();
        expect(mockSock.getComments).toHaveBeenCalledWith('api/jobs/604', moment());
      })));
  </code></pre>
  
  <p>which throws the error:</p>
  
  <blockquote>
    <p>Expected spy getComments to have been called with [ 'api/jobs/604', Sat Apr 29 2017 12:31:07 GMT+0100 ] but actual calls were [ 'api/jobs/604', Sat Apr 29 2017 00:00:00 GMT+0100, Sat Apr 29 2017 12:31:07 GMT+0100 ].</p>
  </blockquote>
  
  <p>As these strings are clearly identical, I assume this is because the test value of now is several milliseconds later than the value when the component was running and the milliseconds aren't parsed into the string. </p>
  
  <p>So my question is, how can I make my test work, is there a way to check the parameter called with is within x milliseconds of the current time?</p>