DateTime

The DateTime field generates a random date and time between a start and end.

Schema

fields:
  - name: Created
    type: DateTime
    args:
      start: "-10d"
      end: "yesterday"
      timezone: Australia/Perth
      format: "%+"
  - name: Deleted
    type: DateTime
    args:
      start: "-10d"
      end: "today"
      timezone: Australia/Sydney
      format: "%+"
    constraints:
      - type: GreaterThan
        name: Created
  - name: Refs
    type: DateTime
    args:
      # This is how you reference another field.
      start: "{{ refs['Choice'].raw }}"
      end: "2010-01-01T00:00:00Z"
      format: "%A, %B %e, %Y"
    # You must define the fields that you want to reference.
  - name: Choice
    type: WeightedCategory
    args:
      choices:
        - "2000-01-01T00:00:00Z"
        - "1900-01-01T00:00:00Z"

Output

CreatedDeletedRefsChoice
2023-02-01T13:29:35.622865+08:002023-02-02T08:37:35.622865+11:00Saturday, August 12, 19111900-01-01T00:00:00Z
2023-01-27T21:37:35.622865+08:002023-02-02T01:53:35.622865+11:00Saturday, July 26, 19861900-01-01T00:00:00Z
2023-01-26T03:38:35.622865+08:002023-01-30T09:13:35.622865+11:00Wednesday, September 26, 20072000-01-01T00:00:00Z

Arguments

NameTypeDescriptionDefault Value
startstringThe start date. This will accept a variety of inputs, details can be found here.2000-01-01T00:00:00Z
endstringThe end date. This will accept a variety of inputs, details can be found here.3000-01-01T00:00:00Z
timezonestringThe timezone to use.UTC
formatstringThe format to use. The complete list of specifiers can be found here."%+"

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
GreaterThanThe value must be greater than the value of another field.
IfNullThe value must only be non-null if another field is null.