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

Date functions not working #164

Open
KumarNitesh17 opened this issue May 3, 2024 · 2 comments
Open

Date functions not working #164

KumarNitesh17 opened this issue May 3, 2024 · 2 comments

Comments

@KumarNitesh17
Copy link

I tried to render the date functions, it didn't worked.
Do we support date functions?

var Velocity = require('velocityjs'); let strSubj = '#set($link_cid=\'asa-en_US-em-T1\') Test $link_cid link when you manage your keywords. $date.get(\'yyyy\') Test ${cid} ${Mid}' let context = { "Mid": "testV", "cid": "testc" } console.log(Velocity.render(strSubj, context))

Test asa-en_US-em-T1 link when you manage your keywords. $date.get('yyyy') Test testc testV

@shepherdwind
Copy link
Owner

Here is actually a js object, so if there is no date in the context, it will not be able to execute date.get('yyyy') in the template.

If you want support it, you need to implement date by yourself and then pass it through the context.

@KumarNitesh17
Copy link
Author

You mean like this,

const date = new Date()
let context = { "Mid": "testV", "cid": "testc", "date": date }

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