DateParts

Use DateParts for recurring calendar position, such as hour of day or day of week. Derive a Number when elapsed time, age, or recency matters.

created_at: "2026-05-28T14:30:45"
import relflow as rf

created_at = rf.DateParts(
    dateparts=["day_of_week", "hour_of_day"],
    pattern="%Y-%m-%dT%H:%M:%S",
)

Input and options

Accepts Arrow date, timestamp, or string values. Strings are parsed by Arrow using pattern when supplied; otherwise Arrow casts them to timestamps. Calendar extraction uses second-resolution timestamps. Normalize to the intended calendar timezone upstream; the field does not choose a local-time policy.

Option Default Meaning
dateparts required Nonempty, unique list of parts; casing and separators are normalized.
pattern None Optional strptime-style format for Arrow string parsing.
jitter rf.Jitter() Training noise on the generated sine/cosine coordinates.
Part Period
day_of_year 366
week_of_year 53
month_of_year 12
day_of_month 31
week_of_month 6
day_of_week 7
hour_of_day 24
minute_of_hour 60
second_of_minute 60

Representation and output

Each part becomes a sine/cosine pair: the end of a cycle is near its beginning. relflow projects each pair and combines the results with a state embedding. Null, padded, and masked content is zero; state remains separate.

Jitter changes the circle coordinates, not the timestamp, and does not renormalize noisy pairs. Its magnitude is measured in coordinate units. Both settings of jitter.normalize use this same boundary.

Reconstruction learns state cross entropy and mean per-part cosine distance. The per-part mae metric is angular error in radians, not elapsed time.

DateParts has no decoded public content and does not generate timestamps. Use embed=True for a contextual embedding; see shared leaf options.

The month-inference proof tests a recurring relationship on withheld dates and years. The leap-boundary proof shows how selecting too few calendar coordinates can make the answer ambiguous.