From ca3743cc8cf50c549669c6015b8f20eb9ad8e47f Mon Sep 17 00:00:00 2001 From: Bastien PIERRE Date: Mon, 28 Jul 2025 11:25:03 +0200 Subject: [PATCH] [IMP] web: datetime new format and numeric attribute --- content/applications/studio/fields.rst | 12 ++++--- .../frontend/javascript_reference.rst | 32 +++++++++++++++---- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/content/applications/studio/fields.rst b/content/applications/studio/fields.rst index d92b0fd8c..cf23e0a2d 100644 --- a/content/applications/studio/fields.rst +++ b/content/applications/studio/fields.rst @@ -550,13 +550,17 @@ widget set, some specific properties are available: :guilabel:`Decade`. If no value is selected, the user can navigate the date selector by decade. - :guilabel:`Warning for future dates`: Enable this property to display a warning icon if a future date is selected. -- :guilabel:`Condensed display`: Enable this property to show days, months and hours with no leading - zeros, e.g., `4/2/2025 8:05:00` instead of `04/02/2025 08:05:00`. +- :guilabel:`Date format`: By default the date will be shown as `Apr 2, 2025, 08:05 AM`. + Enable this property to show the date in the format `4/2/2025 08:05:00`. + The numeric mode is the format set on the current language. In this mode the seconds are always + shown. +- :guilabel:`Show date`: This property is enabled by default for :guilabel:`Date & Time` fields. + Disable this property to show only the time. - :guilabel:`Show time`: This property is enabled by default for :guilabel:`Date & Time` fields. On a read-only field, disable the property to show only the date. This can keep a list view less cluttered, for example. -- :guilabel:`Show seconds`: This property is enabled by default for :guilabel:`Date & Time` fields. - Disable the property to show only hours and minutes. +- :guilabel:`Show seconds`: This property is disabled by default for :guilabel:`Date & Time` fields. + Enable the property to show the seconds. - :guilabel:`Time interval`: Enter a value to determine the minute intervals shown in the time selector. For example, enter 15 to allow quarter-hour intervals. The default value is set to 5 minutes. diff --git a/content/developer/reference/frontend/javascript_reference.rst b/content/developer/reference/frontend/javascript_reference.rst index 18649cfcf..2b2b2d01f 100644 --- a/content/developer/reference/frontend/javascript_reference.rst +++ b/content/developer/reference/frontend/javascript_reference.rst @@ -667,6 +667,9 @@ Char (`char`) Date (`date`) This is the default field type for fields of type `date`. It consists of a text box and a date picker. + The field will show the date in a readable format like this: `Dec 19, 1997`. + The year will be hidden if it's the current one. When editing the field, the numeric format + will be shown. This format corresponds to the one set in the current language. - Supported field types: `date` @@ -680,17 +683,26 @@ Date (`date`) - - warn_future: displays a warning if the value is in the future (based on today). + - `warn_future`: displays a warning if the value is in the future (based on today). .. code-block:: xml + - `numeric`: when set to true, it shows the date in the format set on the current language. + (default: `false`). + + .. code-block:: xml + + + .. _reference/javascript_reference/datetime_field: Date & Time (`datetime`) This is the default field type for fields of type `datetime`. The values are always - in the client's timezone. + in the client's timezone. The displayed format has the same behaviour as the date + field, see :ref:`Date Field ` description. + The readable format looks like this: `Dec 19, 1997, 10:45 AM`. - Supported field types: `datetime` @@ -706,13 +718,13 @@ Date & Time (`datetime`) - - `show_seconds`: when set to false, it hides the seconds from the datetime field. - The field will still accept datetime values, but the seconds will be hidden in - the UI (default: `true`). + - `show_seconds`: when set to true, it shows the seconds from the datetime field. + The field will still accept datetime values, but the seconds will be shown in + the UI (default: `false`). .. code-block:: xml - + - `show_time`: when set to false, it hides the time part from the datetime field. The field will still accept datetime values, but the time part will be hidden in @@ -722,6 +734,14 @@ Date & Time (`datetime`) + - `show_date`: when set to false, it hides the date part from the datetime field. + The field will still accept datetime values, but the date part will be hidden in + the UI (default: `true`). + + .. code-block:: xml + + + Date Range (`daterange`) This widget allows the user to select start and end date from a single picker.