Immutable, composable date operations for the Pure ecosystem — comparison conditions and utilities over IDate primitives.
Pure.Primitives.Date.Operations provides sealed record types that operate on IDate values from the Pure ecosystem. All types implement either IBool (returning a boolean result) or INumber<T> (returning a numeric result), and are fully AOT-compatible.
All comparison types accept a sequence of IDate values and implement IBool.
| Type | Description |
|---|---|
EqualCondition |
true if all dates in the sequence are identical |
NotEqualCondition |
true if any two dates in the sequence differ |
BeforeCondition |
true if dates are in strictly ascending chronological order |
AfterCondition |
true if dates are in strictly descending chronological order |
NotBeforeCondition |
true if dates are in non-descending order (ascending or equal) |
NotAfterCondition |
true if dates are in non-ascending order (descending or equal) |
| Type | Implements | Description |
|---|---|---|
DayNumber |
INumber<uint> |
Converts a single IDate to its absolute day number (via DateOnly.DayNumber) |
- Immutable — all state is set at construction;
BoolValue/NumberValueare pure computed properties. - Composable — every type implements a Pure abstraction interface and can be used anywhere
IBoolorINumber<T>is accepted. - AOT-compatible — no reflection; safe for Native AOT and trimming.
Pure.Primitives.Abstractions4.3.0 — base interfaces for the Pure ecosystem (IDate,IBool,INumber<T>, and other immutable primitive abstractions)
- .NET 7
- .NET 8
- .NET 9
- .NET 10
dotnet add package Pure.Primitives.Date.Operationsusing Pure.Primitives.Date.Operations;
// Check if a list of dates is in ascending order
IBool condition = new BeforeCondition(startDate, midDate, endDate);
if (condition.BoolValue)
{
// dates are strictly ascending
}
// Convert a date to its absolute day number
INumber<uint> dayNum = new DayNumber(someDate);
uint day = dayNum.NumberValue;