Skip to main content
Version: v0.0.5

Function: dateYmd()

dateYmd(rng, minYear?, maxYear?): string

A synthetic date in HL7 YYYYMMDD form, drawn uniformly within an inclusive year range. Comes from the seeded generator (never wall-clock), so it is reproducible and implies no real event.

Parameters

rng

Rng

The seeded generator.

minYear?

number = 1930

Inclusive lower year bound (default 1930).

maxYear?

number = 2010

Inclusive upper year bound (default 2010).

Returns

string

An YYYYMMDD date string (always a valid calendar day).

Example

import { createRng, dateYmd } from "@cosyte/synth";
dateYmd(createRng(1), 1970, 2000); // "YYYYMMDD"