Skip to main content

CnDurationField

Edits an ISO 8601 duration as a number plus a unit (minutes, hours, days, weeks, months, years). CnFormDialog renders it for a property with type: string and format: duration, or for fieldOverrides.<key>.widget: 'duration'.

P56D shows 56 and days. Changing the unit writes the canonical string for that unit. A value that is not exactly one unit (P1DT2H) shows as read-only ISO text with an "Edit as ISO" button, so nothing is rounded. Clearing the number writes null. In CnFormDialog, a schema minimum or maximum given as an ISO string is compared in seconds.

Usage​

<CnDurationField v-model="term" input-label="Handling term" />

Props​

PropTypeDefaultDescription
modelValueStringnullISO 8601 duration string (v-model), or null.
inputLabelString''Accessible label of the number input.
unitLabelString'Unit'Accessible label of the unit select.
disabledBooleanfalseDisable both inputs.
errorBooleanfalseShow the inputs in their error state.

Events​

EventPayloadDescription
update:modelValuestring | nullThe ISO string for the chosen amount and unit; null when the amount is cleared.