From 80c5761af4e43b6e95acb0d1521edb5a74797420 Mon Sep 17 00:00:00 2001 From: 0phoff <0phoff@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:34:19 +0100 Subject: [PATCH] Added "locale" option to the date format of the customapi --- docs/widgets/services/customapi.md | 1 + src/widgets/customapi/component.jsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/widgets/services/customapi.md b/docs/widgets/services/customapi.md index f39d8d5e..ed3cab5f 100644 --- a/docs/widgets/services/customapi.md +++ b/docs/widgets/services/customapi.md @@ -34,6 +34,7 @@ widget: - field: key # needs to be YAML string or object label: Field 4 format: date # optional - defaults to text + locale: nl # optional dateStyle: long # optional - defaults to "long". Allowed values: `["full", "long", "medium", "short"]`. timeStyle: medium # optional - Allowed values: `["full", "long", "medium", "short"]`. ``` diff --git a/src/widgets/customapi/component.jsx b/src/widgets/customapi/component.jsx index fcf6e82f..e5c2e0e4 100644 --- a/src/widgets/customapi/component.jsx +++ b/src/widgets/customapi/component.jsx @@ -70,7 +70,7 @@ function formatValue(t, mapping, rawValue) { value = t("common.bitrate", { value }); break; case "date": - value = t("common.date", { value, dateStyle: mapping?.dateStyle ?? "long", timeStyle: mapping?.timeStyle }); + value = t("common.date", { value, lng: mapping?.locale, dateStyle: mapping?.dateStyle ?? "long", timeStyle: mapping?.timeStyle }); break; case "text": default: