new Date() error
alexandre1985 opened this issue · comments
I have this index.ejs
file:
<p>
<% new Date().getFullYear(); %>
</p>
and it is not outputing the date.
I also tried this:
<p>
<%= new Date().getFullYear(); %>
</p>
and it gave me this error:
tinyjam v0.4.0
compile index.ejs
undefined:4
` + _esc(_str( new Date().getFullYear();
^
SyntaxError: missing ) after argument list
at new Function (<anonymous>)
at compile (file:///home/daniel/.npm/_npx/3e46eb4798690ec4/node_modules/yeahjs/index.js:30:16)
at render (file:///home/daniel/.npm/_npx/3e46eb4798690ec4/node_modules/tinyjam/index.js:50:26)
at tinyjam (file:///home/daniel/.npm/_npx/3e46eb4798690ec4/node_modules/tinyjam/index.js:40:13)
at file:///home/daniel/.npm/_npx/3e46eb4798690ec4/node_modules/tinyjam/cli.js:22:5
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
Node.js v17.3.0
I am on a ArchLinux machine and I have installed tinyjam using npx tinyjam
.
I also run tinyjam using npx tinyjam
.
I am running as such:
cd my-website/
npx tinyjam . public/
It's because of the ;
— when you use <%=
for outputting a value, it expects a valid JS expression (e.g. something that can be surrounded with parens).