Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions content/applications/studio/fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ Date (`date`)

The :guilabel:`Date` field is used to select a date on a calendar.

- :guilabel:`Remaining Days`: the remaining number of days before the selected date is displayed
(e.g., *In 5 days*), based on the current date. This field should be set to :guilabel:`Read only`.
- :guilabel:`Relative Date`: expresses the field value in relation to the current date using
relative terms such as :guilabel:`Yesterday`, :guilabel:`Today`, :guilabel:`In 3 days`,
:guilabel:`2 months ago`, etc. This field should be set to :guilabel:`Read only`.

.. example::

Expand Down Expand Up @@ -255,13 +256,6 @@ To add a date range:
.. image:: fields/date-time-examples.png
:alt: Examples of Date & Time fields with different widgets

Remaining Days (`remaining_days`)
*********************************

The :guilabel:`Remaining Days` widget displays the remaining number of days before the selected date
(e.g., *In 5 days*), based on the current date and time. This field should be set to :guilabel:`Read
only`.

.. _studio/fields/simple-fields-checkbox:

Checkbox (`boolean`)
Expand Down
Binary file modified content/applications/studio/fields/date-examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified content/applications/studio/fields/date-time-examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions content/developer/reference/frontend/javascript_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -808,10 +808,18 @@ Date Range (`daterange`)

<field name="start_date" widget="daterange" options="{'end_date_field': 'end_date'}" />

Remaining Days (`remaining_days`)
Relative Date (`relative_date`)
This widget can be used on date and datetime fields. In readonly, it displays
the delta (in days) between the value of the field and today. The widget turns
into a regular date or datetime field in edit mode.
a human-readable relative calendar string computed from the difference between
the field value and today (e.g. *"yesterday"*, *"today"*, *"in 3 days"*,
*"next month"*). The exact format depends on the magnitude of the difference:

- Within ±30 days: the unit is forced to *days* (e.g. *"in 5 days"*, *"3 days ago"*).
- Between 31 and 99 days: Luxon picks the most appropriate unit automatically
(e.g. *"next month"*, *"2 months ago"*).
- Beyond ±99 days: the widget falls back to the formatted date string.

In edit mode the widget falls back to a regular date/datetime field.

- Supported field types: `date`, `datetime`

Expand Down