@amimpact/willy-utils 1.3.6 → 1.3.7

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.
package/dist/date.d.ts CHANGED
@@ -17,6 +17,13 @@ interface FormatCraftDateOptions {
17
17
  * @memberof FormatCraftDateOptions
18
18
  */
19
19
  format: string;
20
+ /**
21
+ * i18n Locale mee kunnen geven
22
+ *
23
+ * @type {string}
24
+ * @memberof FormatCraftDateOptions
25
+ */
26
+ locale: string;
20
27
  /**
21
28
  * Amerikaans formaat maken om in Craft op te kunnen slaan, anders Nederlands
22
29
  *
package/dist/date.js CHANGED
@@ -26,6 +26,7 @@ var availableLocales = {
26
26
  */
27
27
  exports.formatCraftDate = function (dateObject, options) {
28
28
  var dateFormat = options && options.systemFormat ? 'yyyy-MM-dd' : 'dd-MM-yyyy';
29
+ var localeString = 'nl';
29
30
  if (options && options.showTime) {
30
31
  dateFormat += ' HH:mm';
31
32
  }
@@ -33,6 +34,10 @@ exports.formatCraftDate = function (dateObject, options) {
33
34
  if (options && options.format) {
34
35
  dateFormat = options.format;
35
36
  }
37
+ // Locale mee kunnen geven
38
+ if (options && options.locale) {
39
+ localeString = options.locale;
40
+ }
36
41
  if (!dateObject || !dateObject.date) {
37
42
  return '';
38
43
  }
@@ -44,7 +49,7 @@ exports.formatCraftDate = function (dateObject, options) {
44
49
  var dateToFormat = dateObject.date.replace(/-/g, '/').split('.')[0];
45
50
  // De spatie tussen datum en tijd vervangen door 'T', anders snapt IE het niet
46
51
  return format_1.default(new Date(dateToFormat), dateFormat, {
47
- locale: locale_1.nl,
52
+ locale: availableLocales[localeString],
48
53
  });
49
54
  };
50
55
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amimpact/willy-utils",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "Javascript utils",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",