hey!
First run at ACC here, and trying to convert the current date into French months:
<%= formatDate(new Date(), "%D %Bi %Y") %>,
So instead of 20 July 2020, i would it to say 20 juillet 2020
Views
Replies
Total Likes
Hello @connorSlack24 ,
You can use moment.js in your workflow to achieve this.
Just download the moment.js library (from here). Then upload it in Administration > Configuration > JavaScript Codes
Then in your workflow you can use this code.
loadLibrary('NAMESPACE:moment.js');
var myDate=formatDate(new Date(), "%D %Bi %Y");
var frenchDate=moment(myDate, 'DDD MMMM YYYY', 'fr');
More Information on date formatting is available here: https://momentjs.com/docs/#:~:text=moment(%2212%2D25%2D,valid%20dates%20over%20invalid%20ones.
Let me know if that works.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Hey Jonathon, Thanks!
Hey! My problem is the correct syntax, as i am new to eJS (coming from Freemarker) i cant seem to get it right:
<%= formatDate(toLocaleDateString('fr-CA), "%D %Bl, %Y") %>
Doesnt seem to work, but chances are im not coding it correctly.
Views
Replies
Total Likes
Views
Replies
Total Likes
Use the below, remove any js libs installed for this:
<%=
new Date().toLocaleDateString('fr-CA', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
%>
Thanks,
-Jon
Views
Replies
Total Likes
Hey Jon,
I added that script to my personalization block, and called that into my delivery, and i am getting this error:
Error while evaluating document
JST-310000 Error while compiling script 'content htmlContent' line 20: missing ) after argument list (line=' }); ' token='; ').
SCR-160032 Javascript: error while compiling script 'content htmlContent'.
JST-310007 Unable to compile script (content htmlContent).
Views
Replies
Total Likes
@connorSlack24 Did this error get resolved?
Views
Replies
Total Likes
Views
Replies
Total Likes
@_Manoj_Kumar_ @Jonathon_wodnicki Can any of you further help with @connorSlack24 's query?
Thanks!