Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data.parse is not a constructor?

Tags:

javascript

I am using http://nithinbekal.com/2009/javascript-how-to-create-a-simple-countdown-timer/ But when I run it in firefox I get the error Data.parse is not a constructor. So what will I need to do to solve this?

<script type="text/javascript">
 function updateWCTime() {
now      = new Date();
kickoff  = new Date.parse("June 11, 2012 11:30:00");
diff = kickoff - now;

days  = Math.floor( diff / (1000*60*60*24) );
hours = Math.floor( diff / (1000*60*60) );
mins  = Math.floor( diff / (1000*60) );
secs  = Math.floor( diff / 1000 );

dd = days;
hh = hours - days  * 24;
mm = mins  - hours * 60;
ss = secs  - mins  * 60;

document.getElementById("ct").innerHTML =  dd + " days " + hh + " hours " + mm + " minutes " + ss + " seconds";
}
 setInterval(function() { updateWCTime() }, 1000 );

like image 661
Aaron Avatar asked Mar 21 '26 14:03

Aaron


1 Answers

Remove new from this line. Date.parse is just a method.

kickoff  = Date.parse("June 11, 2012 11:30:00");
like image 124
BNL Avatar answered Mar 23 '26 05:03

BNL