Forged’s temporal extension methods let you post-process anyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/atulin/forged/llms.txt
Use this file to discover all available pages before exploring further.
Generator<DateTime> without reaching for .Refine() by hand. They are declared in DateTimeGeneratorExtensions using the C# 14 extension member syntax and cover the four most common tasks when shaping date-time data: normalising the DateTimeKind, extracting only the date or time component, and stripping the time portion entirely.
These extensions are defined on
Generator<DateTime> specifically. They are not available on Generator<DateTimeOffset>, Generator<DateOnly>, or Generator<TimeOnly>. Use .Refine() for those types.Timezone / kind normalisation
.ToUtc()
Marks the generated DateTime as UTC by applying DateTime.SpecifyKind(value, DateTimeKind.Utc). The date and time components are not shifted — only the Kind property changes.
Returns Generator<DateTime>
.ToLocal()
Marks the generated DateTime as local time by applying DateTime.SpecifyKind(value, DateTimeKind.Local). As with .ToUtc(), the numeric date/time values are unchanged.
Returns Generator<DateTime>
Component extraction
.ToDateOnly()
Extracts only the date portion of the generated DateTime via DateOnly.FromDateTime(value), discarding all time-of-day information.
Returns Generator<DateOnly>
.ToTimeOnly()
Extracts only the time-of-day portion of the generated DateTime via TimeOnly.FromDateTime(value), discarding the date.
Returns Generator<TimeOnly>
Truncation
.TruncateToDate()
Returns a DateTime whose time component is set to midnight (00:00:00.000) by reading the .Date property of the generated value. The DateTimeKind of the original value is preserved.
Returns Generator<DateTime>
Combining extensions
Temporal extensions return a newGenerator<DateTime> (or Generator<DateOnly> / Generator<TimeOnly>) and can be chained with any other modifier in the pipeline.