T.date
A scalar.
T.date.whereby({ min: new Date("2020-01-01"), max: new Date() });
T.date.whereby({
min: { value: new Date("2020-01-01"), exclusive: true },
max: new Date(),
});
T.date.whereby({ min: new Date("2020-01-01") }); // 2020 up to the latest representable
T.date.past; // any instant from the earliest representable up to "now"
T.date.future; // any instant from "now" up to the latest representable
T.date.past.whereby({ min: new Date("2020-01-01") });
T.date.future.whereby({ max: new Date("2030-01-01") });
T.date.whereby({ min: 0, max: 1_700_000_000_000 }); // milliseconds since the epochLeave out min or max to leave that end open. A missing min is the earliest representable instant, and a missing max is the latest. Adapters only see the ends you set.
An end can be a Date or a number of milliseconds since the epoch, the same as initialize({ clock }). The number must be one a Date holds exactly, so a fraction or a value outside the Date range throws InvalidBoundError instead of being rounded.
.admits({ min, max }) changes what adapters accept without changing what is generated. On .past it takes only min, and on .future only max, because the other end is "now". See .admits(...). For dates that never repeat, see T.unique.date.
.past and .future work bare, or you can narrow them with their own .whereby(). Both accept a distribution. See Distributions. An exclusive min or max leaves out that exact millisecond. A Date has millisecond precision, so the range starts or ends one millisecond inside the value you gave.
"Now" is the instance's clock. By default, that is the time of the initialize() call, so a bare T.date.past or .future is relative to the real present. Pass initialize({ clock: someDate }) to pin "now" to a fixed date. With clock: "derived", "now" is computed from the salt and can be any date in the representable range, so an absurd date is expected. See The clock is the entropy.
