From fc67e1a986b136f518491ed1fd537c4a84eafa7e Mon Sep 17 00:00:00 2001 From: Mohamed Aziz Ben Aissa Date: Thu, 9 Nov 2023 21:57:14 +0100 Subject: [PATCH] Feature: Added timeStyle to date format for custom API (#2294) * Add timeStyle option to custom API date format * Update documentation --- 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 2834ea280..f39d8d5ea 100644 --- a/docs/widgets/services/customapi.md +++ b/docs/widgets/services/customapi.md @@ -35,6 +35,7 @@ widget: label: Field 4 format: date # optional - defaults to text dateStyle: long # optional - defaults to "long". Allowed values: `["full", "long", "medium", "short"]`. + timeStyle: medium # optional - Allowed values: `["full", "long", "medium", "short"]`. ``` Supported formats for the values are `text`, `number`, `float`, `percent`, `bytes`, `bitrate` and `date`. diff --git a/src/widgets/customapi/component.jsx b/src/widgets/customapi/component.jsx index a9e0890d4..fcf6e82f9 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" }); + value = t("common.date", { value, dateStyle: mapping?.dateStyle ?? "long", timeStyle: mapping?.timeStyle }); break; case "text": default: