From b94a59081b25f563c9c4090ad3543e400d52c653 Mon Sep 17 00:00:00 2001 From: Bastien PIERRE Date: Mon, 15 Dec 2025 15:07:14 +0100 Subject: [PATCH] [IMP] web: beautiful duration Change float_time field with the new options and format. TASK-5347051 --- .../frontend/javascript_reference.rst | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/content/developer/reference/frontend/javascript_reference.rst b/content/developer/reference/frontend/javascript_reference.rst index d155fcd5ba..b4c55458ac 100644 --- a/content/developer/reference/frontend/javascript_reference.rst +++ b/content/developer/reference/frontend/javascript_reference.rst @@ -607,14 +607,14 @@ Float (`float`) .. code-block:: xml - + - `step`: set the step to the value up and down when the user click on buttons (only for input of type number, `1` by default) .. code-block:: xml - + - `format`: should the number be formatted. (`true` by default) @@ -623,22 +623,56 @@ Float (`float`) .. code-block:: xml - + - `hide_trailing_zeros`: hide zeros to the right of the last non-zero digit, e.g. `1.20` becomes `1.2` (`false` by default). .. code-block:: xml - + Time (`float_time`) The goal of this widget is to display properly a float value that represents - a time interval (in hours). So, for example, `0.5` should be formatted as `0:30`, - or `4.75` correspond to `4:45`. + a time interval (in hours by default). So, for example, `0.5` should be formatted as `30m`, + or `4.75` correspond to `4h 45m`. - Supported field types: `float` + Options: + + - `numeric`: set the format type (`false` by default) + + If set to `true` the format will be `hh:mm:ss`. + + .. code-block:: xml + + + + - `type`: set the input type (`"text"` by default, can be set on `"number"`) + + In edit mode, the field is rendered as an input with the HTML attribute type + set on `"number"` (so user can benefit the native support, especially on + mobile). + + .. code-block:: xml + + + + - `show_seconds`: display the seconds (`true` by default) + + .. code-block:: xml + + + + - `unit_of_time`: specify what is the unit of time of the float value (`"hours"` by default) + + The units of time available are: `"hours"`, `"minutes"` and `"seconds"`. + + .. code-block:: xml + + + Float Factor (`float_factor`) This widget aims to display properly a float value that converted using a factor given in its options. So, for example, the value saved in database is `0.5` and the