I have to create a function that calculates the time in seconds from now to July 4th.
This is what I have so far:
function getTimeDiff(fdate, pdate) {
var fSeconds = fdate.getTime();
var pSeconds = pdate.getTime();
var secondsLeft = (fSeconds - pSeconds) / 1000
return secondsLeft;
}
var x = getTimeDiff(new Date(2019, 6, 4, 0, 0), new Date());
console.log(x);
When I run the code in my browser it states that
"fdate.getTime() is not a function"
How do I fix this?