Forger Help

Date Settings

Two options control date generation: dateMin and dateMax, both inclusive.

Defaults and usage

Option

Type

Default

dateMin

Date or string

new Date(2000, 0, 1)

dateMax

Date or string

new Date(4000, 0, 1)

const signedAt = Forger.create<Date>({ dateMin: new Date(2024, 0, 1), dateMax: new Date(2024, 11, 31), })!;

String values are accepted

Both bounds may be strings — they are converted to Date at generation time:

const quarter = Forger.create<Date>({ dateMin: '2024-01-01', dateMax: '2024-03-31', })!;

This keeps settings JSON-serializable when they come from fixtures or configuration.

Inverted bounds are auto-fixed

If dateMin is later than dateMax, the maximum becomes dateMin + 24 hours:

const oops = Forger.create<Date>({ dateMin: new Date(2030, 0, 1), dateMax: new Date(2020, 0, 1), })!; // a date within [2030-01-01, 2030-01-02]

Relative windows

Compute the settings object at test time for relative windows — see Dates for a "last week" recipe and Cookbook for more.

08 September 2026