Component description

The date component renders a date attribute on an object page. Without a rules block it behaves as a standard date input with no future-date restriction.

When a rules block is configured, the component enforces a conditional max-future-date limit. The allowed date range is determined dynamically by the value of a second attribute on the same record — the driver attribute. When the driver matches a threshold, the date picker disables days beyond the limit and shows an inline hint with the active limit. Both the frontend and backend block saving a date that exceeds the limit.

Warning

attributeTypeKey must point to an attribute type with the is_date or is_datetime feature. Attributes with only is_time are not supported.

Minimal JSON

{
    "type": "date",
    "key": "",
    "attributeTypeKey": "effective_from"
}

The following example limits a date attribute to 3 years in the future when a regulation flag is set to YES, or 6 years when set to NO. If the flag is empty, no limit applies.

{
    "type": "date",
    "componentId": "ppo#date#effective_from",
    "key": "ppo.effective_from.field",
    "title": "ppo.effective_from",
    "attributeTypeKey": "effective_from",
    "rules": {
        "driverAttributeTypeKey": "regulation_flag",
        "thresholds": [
            {
                "driverValue": "YES",
                "limit": {
                    "kind": "years",
                    "value": 3
                },
                "errorTranslationKey": "effective_from.error.max_3y"
            },
            {
                "driverValue": "NO",
                "limit": {
                    "kind": "years",
                    "value": 6
                },
                "errorTranslationKey": "effective_from.error.max_6y"
            }
        ],
        "fallback": {
            "limit": {
                "kind": "none"
            }
        }
    }
}

Nested properties

PropertyDescriptionValuesMandatory
typedatestringYes
keyUnique key of the component. If multiple components have the same key, they will all have the same attribute value. Used for referencing in the same package or other packages using packageKey#componentKey.stringYes
attributeTypeKeyKey of the date attribute to render. Must point to an attribute type with the is_date or is_datetime feature.stringYes
componentIdUnique ID of a component. If left empty, a random string will be generated. Primarily used in patch packages to define the component’s position within the layout (template).stringNo
rulesConditional max-future-date validation block. When omitted, the date picker is open for any future date. See [[slug
]].
jsonNo
titleTranslation key of the title. Define the key in translations to specify how the text is displayed in the UI. Unlike the name property, if you use a specific string of text for the title, this text will appear with the package key. For example, Comment Section will be displayed as package_key_comment section.stringNo