Skip to content

Repository files navigation

Pure.Primitives.DateTime.Operations

Temporal comparison conditions and ordering checks for IDateTime values in the Pure ecosystem.

.NET build & testBuild and DeployNuGetLicense: MIT

Overview

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.

Types

TypeTrue when
EqualConditionAll supplied IDateTime values represent the same moment
AfterConditionEach value in the sequence is strictly after the previous (ascending order)
BeforeConditionEach value in the sequence is strictly before the previous (descending order)
NotEqualConditionNot all values represent the same moment
NotAfterConditionThe sequence is not strictly ascending
NotBeforeConditionThe 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.

Design Principles

  • IBool results — every condition is an IBool, not a raw bool, keeping results composable within the Pure type system.
  • Value semantics — all types are sealed records; GetHashCode and ToString are deliberately unsupported.
  • AOT-compatible — no reflection; the library is fully compatible with Native AOT compilation.

Dependencies

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Installation

dotnet add package Pure.Primitives.DateTime.Operations

Usage

usingPure.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

About

Temporal comparison conditions and ordering checks for IDateTime values in the Pure ecosystem — six IBool condition types.

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

Generated from kudima03/Pure.Template