[later phase] Support `daterange_default` field widget in component instance form

Created on 8 May 2025, 4 days ago

Overview

The all-props test-only SDC has had a test_object_drupal_date_range prop since … before the 0.x branch or XB d.o issues even started, i.e. since commit 7dcc12fa3bb9246870f995ce0b7c437b4ad0f62c from April 26, 2024 (), which introduced json-schema-definitions://sdc_test_all_props.module/date-range.

We've used hook_storage_prop_shape_alter() on behalf of the datetime_range module for a very long time too, to indicate that that module is not necessary for XB, but if you install it, then you can support date range prop shapes too.

Steps to reproduce:

    I manually tested this and ~verified it indeed works correctly :thumbsup:~ sadly it does not work.

    Steps to reproduce:

    1. install datetime_range module
    2. install sdc_test_all_props module
    3. enable web inspector
    4. drag all-props component onto canvas
    5. observe that in the request to generate the component instance form, this is included:
      …
          "test_object_drupal_date_range": {
            "expression": "ℹ︎daterange␟{from↠end_value,to↠value}",
            "sourceType": "static:field_item:daterange",
            "value": [],
            "sourceTypeSettings": {
              "storage": {
                "datetime_type": "date"
              }
            }
          },
      …
      
    6. Observe the markup for the start date in the widget contains name="xb_component_props[<uuid>][test_object_drupal_date_range][0][value][date]"
    7. pick a start date, this results in something like this being sent to the server in xb_form_props, and matches the name attribute observation above:
      …
          "test_object_drupal_date_range": {
            "expression": "ℹ︎daterange␟{from↠end_value,to↠value}",
            "sourceType": "static:field_item:daterange",
            "value": [
              {
                "value": {
                  "date": "2025-05-07"
                },
                "end_value": {
                  "date": ""
                }
              }
            ],
            "sourceTypeSettings": {
              "storage": {
                "datetime_type": "date"
              }
            }
          },
      
    8. … which matches the name attribute.

    So: this doesn't actually work yet. So this change to the test must be reverted; otherwise this test becomes meaningless. Its purpose is to track progress of _working_ field widgets.

Proposed resolution

  1. Define the missing client-side transforms. It looks like the existing dateTime client-side transform already has a type: date option which would work well here.
  2. e2e test in prop-types.cy.js

User interface changes

Feature request
Status

Postponed

Version

0.0

Component

Redux-integrated field widgets

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024