Open
Description
I'm using
"email-templates": "^2.5.4",
"handlebars": "^4.0.6",
"handlebars-intl": "^1.1.2",
"handlebars-layouts": "^3.1.4"
This is how I'm formatting
{{formatNumber price style="currency" currency="USD" locales="en-US"}}
And here's my js file
const handlebars = require('handlebars');
const handlebarsIntl = require('handlebars-intl');
handlebarsIntl.registerWith(handlebars);
handlebars.registerHelper(layouts(handlebars));
handlebars.registerPartial('layout', fs.readFileSync(`public/email-template/layout.hbs`, 'utf8'));
var intlData = {
locales: 'en-US'
// I also tried to follow this: https://formatjs.io/handlebars/ (Using Named Number Formats)
};
var newsletter = new EmailTemplate(path, {
data: { intl: intlData }
});
handlebars.registerPartial('data', { intl: intlData });
newsletter.render({ params: { ... }, data: { intl: intlData } }, function (err, result) {
if(err) { return reject(err); }
return resolve(result.html);
});
Everything that I tried, or nothing happens or I got this error
ReferenceError: Could not find Intl object: formats.number.USD at intlGet (E:\www\unclehub\v0.2.2\api\node_modules\handlebars-intl\lib\helpers.js:96:23)
Metadata
Metadata
Assignees
Labels
No labels