Duration

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.

Schema

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

Output

AgeBirthdateSeconds
361986-09-11
212001-11-24
1995-12-06120
1906-07-29120
1907-05-14120

Arguments

NameTypeDescriptionDefault Value
startstringThe start of the duration. This will accept a variety of inputs, details can be found here.
endstringThe end of the duration. This will accept a variety of inputs, details can be found here.
componentstringThe component to use. This can be one of: Years, Months, Weeks, Days, Hours, Minutes, Seconds.Seconds

Field arguments

NameTypeDescriptionDefault Value
null_probabilityfloatThe probability that the field will be null.0.0
constraintslistA list of constraints to apply to the field.[]

Supported constraints

NameDescription
IfNullThe value must only be non-null if another field is null.