Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in functions not running? #39

Closed
michaeljon opened this issue Apr 22, 2020 · 1 comment
Closed

Built-in functions not running? #39

michaeljon opened this issue Apr 22, 2020 · 1 comment

Comments

@michaeljon
Copy link

I'm assuming that I'm doing something completely wrong here. I'm trying to move some simple templates over to node. But, this one isn't firing and it's not clear from the docs or the source why this isn't working. I'm using 3.1.0

const jsmart = require('jsmart'); const template = '<td><strong>Date Collected: </strong>{strtotime($collection_date)|date_format:"m/d/Y"}</td>'; const compiled = new jsmart(template); console.log(compiled.fetch({ collection_date: '2020-01-01' }));

<td><strong>Date Collected: </strong>m/d/Y</td>

@umakantp
Copy link
Owner

strtotime is not defined in the JS/Node so it would not work. You will have to define the function yourself like

function strtotime() {
// write up here
}

You could refer the function here: https://locutus.io/php/datetime/strtotime/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants