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
| Property | Description | Values | Mandatory |
|---|---|---|---|
driverValue | The driver attribute value that activates this threshold. Exact match. Type follows the driver attribute (string, boolean, or integer). | string / boolean / integer | Yes |
limit | The max-future-date limit when this threshold is active. See limit properties. | json | Yes |
errorTranslationKey | Translation 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. | string | No |
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
| Property | Description | Values | Mandatory |
|---|---|---|---|
kind | The shape of the limit. See Supported kind values. | string | Yes |
value | Number of days or years the date can be in the future. Not used when kind is none. | integer | No |
countedFrom | Key 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. | string | No |
Supported kind values
| Value | Description |
|---|---|
days | Date must be at most value days after the base date — today by default, or the date in the countedFrom attribute. |
none | No restriction — picker is open for any future date. countedFrom does not apply. When used as the fallback limit, no validation error is ever generated. |
years | Date 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.
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
countedFromchanges within the same form session. - While the attribute named by
countedFromholds 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
countedFromholds no valid date. - The backend rejects a date saved against a
countedFromlimit if the attribute named bycountedFromholds no valid date. The limit doesn’t fall back to today. - Editing or clearing the attribute named by
countedFromis 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.