How to create a spy on Date functions in jasmine testing
<p>I have following function and spec. I have created spy on date objects which I am passing and manipulating in my function. But spy is not created on rightDate . Can you guys help me to solve this ? </p>

<pre><code> var jasmineFunc = new function(leftDate, rightDate){

    var leftDateFormat= leftDate.format("H:mm");

    rightDate= new Date(rightDate- 60000);

    var rightDateFormat = rightDate.format("H:mm");

    }

Spec:

describe("format", function(){

   var leftDate = new Date(2016, 0, 1, 0, 0, 0, 0);

  var rightDate= new Date(2016, 0, 1, 2, 0, 0, 0);

   spyOn(leftDate,"format").and,returnValue("00:00");

   spyOn(rightDate, "format").and.returnValue("00:59");
});
</code></pre>