javascript - Uncaught SyntaxError: missing ) after argument list Google App Engine, Jinja 2 -


this time.js file:

function timesince(date) {     var seconds = math.floor((new date() - date) / 1000);     var interval = math.floor(seconds / 31536000);     var timesince = "";     if (interval > 1) {         timesince = interval + " years";     }     interval = math.floor(seconds / 2592000);     if (interval > 1) {         timesince = interval + " months";     }     interval = math.floor(seconds / 86400);     if (interval > 1) {         timesince = interval + " days";     }     interval = math.floor(seconds / 3600);     if (interval > 1) {         timesince = interval + " hours";     }     interval = math.floor(seconds / 60);     if (interval > 1) {         timesince = interval + " minutes";     }     timesince = math.floor(seconds) + " seconds";     document.write(timesince) } 

and html snippet:

<html>     <head>         <title>a simple blog</title>         <meta http-equiv="content-type" content="text/html; charset=utf-8">         <meta name="viewport" content="width=device-width, initial-scale=1.0">         <script type="text/javascript" src="/static/js/time.js"></script>         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">         <link rel="stylesheet" href="/static/css/bootstrap.min.css">         <link rel="stylesheet" href="/static/css/style.css">     </head>         <body>   <div class="post-heading">     <h1>{{post.title}}</h1>     <br><br>     <!-- <h2 class="subheading"></h2> -->     <span class="meta">posted <a href="#">{{post.author.username}}</a> ago.</span>     <script>         timesince({{post.created}});     </script> </div> 

i can't seem find out why keep getting error. i'm using google app engine python , jinja2 build app i'm guessing it's format of js code causing problem perhaps? advice appreciated.

so found out date object in pyhton difference date object in javascript code not work in first place. {{post.created}} doesn't return date object, believe return string correct me if i'm wrong.


Comments