@maioradv/nestjs-core 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,6 +64,12 @@ class EmailBuilder {
64
64
  const subject = parsedSubjects[this.pattern][this.locale];
65
65
  const labels = JSON.parse(Labels);
66
66
  handlebars_1.default.registerHelper('locale', (ctx) => labels[ctx] ?? ctx);
67
+ handlebars_1.default.registerHelper('dateToLocaleString', function (date, locale) {
68
+ return new Date(date).toLocaleString(locale, { dateStyle: 'full', timeStyle: 'short' });
69
+ });
70
+ handlebars_1.default.registerHelper('ternary', function (condition, valTrue, valFalse) {
71
+ return condition ? valTrue : valFalse;
72
+ });
67
73
  handlebars_1.default.registerPartial('header', Header);
68
74
  handlebars_1.default.registerPartial('footer', Footer);
69
75
  handlebars_1.default.registerPartial('body', Body);
@@ -77,7 +83,10 @@ class EmailBuilder {
77
83
  const { subject, template } = await this.initEmail();
78
84
  return {
79
85
  subject: this.replace(subject, args),
80
- html: template(args)
86
+ html: template({
87
+ ...args,
88
+ locale: this.locale
89
+ })
81
90
  };
82
91
  }
83
92
  replace(ctx, replace) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/nestjs-core",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "NestJS helpers by MaiorADV",
5
5
  "repository": "https://github.com/maioradv/nestjs-core.git",
6
6
  "author": "Maior ADV Srl",