Property description

thresholds is an ordered list on the rules block of the date component. Each entry maps a driverValue to a limit, matched by exact comparison against the driver attribute’s current value.

A limit restricts how far in the future a date can be set, expressed as a number of days or years. It’s counted from today by default. Set countedFrom on the limit to count it from the date held in another attribute on the same record instead.

Minimal JSON

{
    "thresholds": [
        {
            "driverValue": "",
            "limit": {
                "kind": "none"
            }
        }
    ]
}

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.

{
    "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"
        }
    ]
}

countedFrom moves the base date to the effective_from attribute. The component accepts a date at most 3 years after the date held in effective_from, instead of 3 years after today.

{
    "thresholds": [
        {
            "driverValue": "YES",
            "limit": {
                "kind": "years",
                "value": 3,
                "countedFrom": "effective_from"
            }
        }
    ]
}

Nested properties

PropertyDescriptionValuesMandatory
driverValueThe driver attribute value that activates this threshold. Exact match. Type follows the driver attribute (string, boolean, or integer).string / boolean / integerYes
limitThe max-future-date limit when this threshold is active. See limit properties.jsonYes
errorTranslationKeyTranslation key for the validation error shown when the date exceeds this limit. Appears inline under the date field, and in the error toast described in Validation and behavior. If omitted, a generic platform error is used.stringNo
Tip

Write the errorTranslationKey text as a statement about the limit, such as “This date exceeds the maximum”. The toast headline already names the field, so the text doesn’t need to name it. Wording that assumes the reader is looking at the field, such as “too far in the future for this field”, reads oddly in the toast.

limit properties

PropertyDescriptionValuesMandatory
kindThe shape of the limit. See Supported kind values.stringYes
valueNumber of days or years the date can be in the future. Not used when kind is none.integerNo
countedFromKey of the attribute on the same record whose date the limit is counted from, instead of today. Valid on days and years limits; ignored on none.stringNo

Supported kind values

ValueDescription
daysDate must be at most value days after the base date — today by default, or the date in the countedFrom attribute.
noneNo restriction — picker is open for any future date. countedFrom does not apply. When used as the fallback limit, no validation error is ever generated.
yearsDate must be at most value years after the base date — today by default, or the date in the countedFrom attribute.

The attribute type named by countedFrom must exist and must carry the is_date or is_datetime feature. It must not be the component’s own attributeTypeKey. Package installation checks all three conditions and reports any failure in the install log.

Warning

The named attribute must hold a valid date before the date field becomes editable.

Validation and behavior

  • The active limit recalculates when the attribute named by countedFrom changes within the same form session.
  • While the attribute named by countedFrom holds no valid date, the date field is read-only. The field shows a message naming the attribute that must be filled in first.
  • Clearing the date remains allowed even when the attribute named by countedFrom holds no valid date.
  • The backend rejects a date saved against a countedFrom limit if the attribute named by countedFrom holds no valid date. The limit doesn’t fall back to today.
  • Editing or clearing the attribute named by countedFrom is rejected if it would push an already-saved dependent date outside its limit. In this case:
    • The attribute keeps its previous value.
    • The error appears on the dependent date field, not the one you edited, and carries that threshold’s errorTranslationKey.
    • If the dependent field isn’t open in edit mode, the error also appears as a toast naming it.