Temporal comparison conditions and ordering checks for IDateTime values in the Pure ecosystem.
Pure.Primitives.DateTime.Operations provides six condition types that evaluate temporal relationships between IDateTime values. Every type implements IBool, so results compose naturally with other Pure primitives — no raw comparisons, no bool scalars leaking into your domain model.
| Type | True when |
|---|---|
EqualCondition | All supplied IDateTime values represent the same moment |
AfterCondition | Each value in the sequence is strictly after the previous (ascending order) |
BeforeCondition | Each value in the sequence is strictly before the previous (descending order) |
NotEqualCondition | Not all values represent the same moment |
NotAfterCondition | The sequence is not strictly ascending |
NotBeforeCondition | The sequence is not strictly descending |
All six types accept params IEnumerable<IDateTime> and implement IBool from Pure.Primitives.Abstractions. Comparison covers all nine temporal fields: year, month, day, hour, minute, second, millisecond, microsecond, and nanosecond.
- IBool results — every condition is an
IBool, not a rawbool, keeping results composable within the Pure type system. - Value semantics — all types are
sealed records;GetHashCodeandToStringare deliberately unsupported. - AOT-compatible — no reflection; the library is fully compatible with Native AOT compilation.
Pure.Primitives.Abstractions— base interfaces (IBool,IDateTime,IDate,ITime,INumber<T>) for the Pure ecosystem
- .NET 7
- .NET 8
- .NET 9
- .NET 10
dotnet add package Pure.Primitives.DateTime.OperationsusingPure.Primitives.DateTime.Operations;IDateTimea= ...;// 2020-01-01T00:00:00IDateTimeb= ...;// 2024-06-15T12:00:00IDateTimec= ...;// 2025-12-31T23:59:59// Are the values in strictly ascending chronological order?boolascending=newAfterCondition(a,b,c).BoolValue;// true// Are all values the same moment?boolsame=newEqualCondition(a,b).BoolValue;// false// Is the sequence strictly descending?booldescending=newBeforeCondition(c,b,a).BoolValue;// true