The Duration field calculates a duration between a start and an end value, with the output being in the specified unit (component of the duration). As this field does not generate a random value it is most useful when used to reference other field/s.
fields:
- name: Age
type: Duration
args:
start: "{{ refs['Birthdate'].raw }}"
end: now
component: Years
constraints:
- type: IfNull
name: Seconds
- name: Birthdate
type: DateTime
args:
format: "%Y-%m-%d"
start: "1900-01-01T00:00:00Z"
end: "2010-01-01T00:00:00Z"
- name: Seconds
type: Duration
null_probability: .5
args:
start: now
end: 120s
Age Birthdate Seconds
36 1986-09-11
21 2001-11-24
1995-12-06 120
1906-07-29 120
1907-05-14 120
Name Type Description Default Value
start string The start of the duration. This will accept a variety of inputs, details can be found here .
end string The end of the duration. This will accept a variety of inputs, details can be found here .
component string The component to use. This can be one of: Years, Months, Weeks, Days, Hours, Minutes, Seconds. Seconds
Name Type Description Default Value
null_probability float The probability that the field will be null. 0.0
constraints list A list of constraints to apply to the field. []
Name Description
IfNull The value must only be non-null if another field is null.