From ff8a95d4941cb5d4392269b30de6f16f64789379 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Tue, 14 May 2024 17:12:47 +0200
Subject: [PATCH] fix: wip new pipeline

---
 source/data/transformer.mjs     | 15 +++++++++++----
 test/cases/data/transformer.mjs | 10 +++++-----
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/source/data/transformer.mjs b/source/data/transformer.mjs
index af210b3c2..e98317fa4 100644
--- a/source/data/transformer.mjs
+++ b/source/data/transformer.mjs
@@ -618,14 +618,14 @@ function transform(value) {
 			if (!match) {
 				throw new Error("invalid currency format");
 			}
-
+			
 			const currency = match[1];
 			const amount = match[2];
 
 			const maximumFractionDigits = args?.[0] || 2;
 			const roundingIncrement = args?.[1] || 5;
 
-			const nf = new Intl.NumberFormat(locale, {
+			const nf = new Intl.NumberFormat(locale.toString(), {
 				style: "currency",
 				currency: currency,
 				maximumFractionDigits: maximumFractionDigits,
@@ -692,7 +692,9 @@ function transform(value) {
 
 			try {
 				locale = getLocaleOfDocument();
-				return date.toLocaleString(locale);
+				return date.toLocaleString(locale.toString(),{
+					hour12: false
+				});
 			} catch (e) {
 				throw new Error(`unsupported locale or missing format (${e.message})`);
 			}
@@ -705,7 +707,12 @@ function transform(value) {
 
 			try {
 				locale = getLocaleOfDocument();
-				return date.toLocaleDateString(locale);
+				return date.toLocaleDateString(locale.toString(),
+					{
+						year: "numeric",
+						month: "2-digit",
+						day: "2-digit"
+					});
 			} catch (e) {
 				throw new Error(`unsupported locale or missing format (${e.message})`);
 			}
diff --git a/test/cases/data/transformer.mjs b/test/cases/data/transformer.mjs
index f01085b07..c2e912ed7 100644
--- a/test/cases/data/transformer.mjs
+++ b/test/cases/data/transformer.mjs
@@ -51,11 +51,11 @@ describe('Transformer', function () {
             ['equals:null', null, true],
             ['equals:null', 3, false],
             ['equals:3', 6, false],
-            ['currency', "EUR0", "0,00 €"],
+            ['currency', "EUR0", "€0.00"], // 0,00 €
            //  ['currency:1:2', "EUR14.25", "14,2 €"],  nodejs and browser have different results (https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/124) 
-            ['currency', "EUR14.25", "14,25 €"],
-            ['datetime', "2023-02-14 14:12:10", "14.2.2023, 14:12:10"],
-            ['datetime', "2023-02-14 08:02:01", "14.2.2023, 08:02:01"],
+            ['currency', "EUR14.25", "€14.25"],
+            ['datetime', "2023-02-14 14:12:10", "2/14/2023, 14:12:10"],
+            ['datetime', "2023-02-14 08:02:01", "2/14/2023, 08:02:01"],
             ['has-entries', {}, false],
             ['has-entries', {a:4}, true],
             ['has-entries', [], false],
@@ -90,7 +90,7 @@ describe('Transformer', function () {
             ['not', true, false],
             ['not', false, true],
             ['map:a=4:b=5:c=6', "a", "4"],
-            ['date', "2023-02-14", "14.2.2023"],
+            ['date', "2023-02-14", "02/14/2023"],
             ['year', "2023-02-14", 2023],
             ['month', "2023-02-14", 2],
             ['day', "2023-02-14", 14],
-- 
GitLab