Skip to content

DurationDisplay ​

Overview ​

Presents a duration in named units rather than its stored literal, so a read view says "730 days" instead of 730 00:00:00. A null or absent value renders the same dash {@link DateTimeDisplay} uses for an empty date.

Both serialized shapes are accepted: the Django duration string DRF's DurationField sends ([-]D HH:MM:SS[.ffffff]) and the number of seconds VUEDA's DurationSecondsField sends. Units that hold zero are left out, so a value only names the parts it has. A duration of zero names the smallest unit ("0 seconds"), which is a recorded value and not the same as no value at all. Sub-second precision is dropped.

Theme entry: DurationDisplay

Props ​

NameTypeRequiredDefaultDescription
themeOverrideObjectnullA partial ThemeObject keyed by component name, merged over this component's theme and provided to descendants.
valuestring|numberundefinedThe value to present, as a Django duration string or a number of seconds. null, undefined, and "" render the dash.
formatstring"long""long" names each unit in full ("2 hours, 30 minutes"); "short" abbreviates it ("2h 30m").
inlinebooleanfalseRenders without a wrapping element, for use inside an existing text row.
classimport('vue').HTMLAttributes['class']undefinedAdditional CSS classes applied to the root.

Source ​

client/lib/display/duration-display/DurationDisplay.vue