Skip to content

๐Ÿ“… Date Transformer โ€‹

The Date transformer is used to generate or replace values with randomized timestamps, returned in RFC 3339 format. When specifying dates in your configuration, both RFC 3339 and RFC 2822 formats are supported.

๐Ÿ” Alternation โ€‹

This transformer does not mutate the existing row value โ€” it generates a new one.

โœ… Valid Data Types โ€‹

  • String

โš™๏ธ Options โ€‹

OptionDescriptionDefault
afterGenerate a random date after the given timestampNone
beforeGenerate a random date before the given timestampNone
betweenGenerate a random date between two timestampsNone

All values must be RFC 3339 or RFC 2822 formatted strings.

๐Ÿงช Examples โ€‹

Example 1: Default behavior โ€‹

Generates a random date close to the current timestamp.

toml
[[table.columns]]
name = "created_at"
transformer = "date"
Input:  "2020-01-01T13:00:00-00:00"
Output: "2024-07-23T17:52:00+00:00"

Example 2: Using after โ€‹

Generates a date after "2023-07-26T13:44:41+04:30".

toml
[[table.columns]]
name = "created_at"
transformer = { date = { after = "2023-07-26T13:44:41+04:30" } }
Input:  "2024-01-01T00:00:00+00:00"
Output: "2023-12-21T09:20:41+00:00"

Example 3: Using before โ€‹

Generates a date before "2023-07-26T13:44:41+04:30".

toml
[[table.columns]]
name = "created_at"
transformer = { date = { before = "2023-07-26T13:44:41+04:30" } }
Input:  "2024-01-01T00:00:00+00:00"
Output: "2021-11-18T22:47:41+00:00"

Example 4: Using between โ€‹

Generates a date between "2023-07-20T13:44:41+04:30" and "2023-07-30T13:44:41+04:30".

toml
[[table.columns]]
name = "created_at"
transformer = { date = { between = { before = "2023-07-30T13:44:41+04:30", after = "2023-07-20T13:44:41+04:30" } } }
Input:  "2024-01-01T00:00:00+00:00"
Output: "2023-07-28T11:34:41+00:00"