Pragmatic.Temporal.AspNetCore 1.0.0-alpha.5

This is a prerelease version of Pragmatic.Temporal.AspNetCore.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Pragmatic.Temporal.AspNetCore --version 1.0.0-alpha.5
                    
NuGet\Install-Package Pragmatic.Temporal.AspNetCore -Version 1.0.0-alpha.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pragmatic.Temporal.AspNetCore" Version="1.0.0-alpha.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pragmatic.Temporal.AspNetCore" Version="1.0.0-alpha.5" />
                    
Directory.Packages.props
<PackageReference Include="Pragmatic.Temporal.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pragmatic.Temporal.AspNetCore --version 1.0.0-alpha.5
                    
#r "nuget: Pragmatic.Temporal.AspNetCore, 1.0.0-alpha.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pragmatic.Temporal.AspNetCore@1.0.0-alpha.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pragmatic.Temporal.AspNetCore&version=1.0.0-alpha.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pragmatic.Temporal.AspNetCore&version=1.0.0-alpha.5&prerelease
                    
Install as a Cake Tool

Pragmatic.Temporal

Type-safe date/time for .NET 10 with DST-aware arithmetic and explicit timezone handling.

The Problem

DateTime and DateTimeOffset are ambiguous: DateTime conflates date, time, and zone behind an easily-ignored Kind; DateTimeOffset keeps an offset but not a zone; calendar arithmetic surprises (Jan 31 + 1 month); DST transitions cause silent bugs; and DateTime.Now makes tests flaky.

The Solution: Type = Scope

The type itself defines the temporal scope, and the compiler enforces it. A LocalDate can't carry time; a ZonedDateTime can't lose its zone.

using Pragmatic.Temporal.Types;

var birthday    = new LocalDate(1990, 5, 15);                          // date only
var opening      = new LocalTime(9, 0);                                 // time only
var appointment = new LocalDateTime(2026, 3, 21, 14, 30);              // wall clock, no zone
var flight       = ZonedDateTime.FromUtc(DateTimeOffset.UtcNow, "Europe/Rome");  // zone-aware

IClock makes "now" injectable and tests deterministic; calendar arithmetic, business days, and DST transitions are handled correctly.

Packages

Package Role
Pragmatic.Temporal Core types, calendar arithmetic, business days, cron, IClock
Pragmatic.Temporal.Json System.Text.Json converters for all temporal types
Pragmatic.Temporal.EFCore EF Core value converters, type mapping, conventions
Pragmatic.Temporal.AspNetCore Middleware, timezone detection, model binding
Pragmatic.Temporal.Testing TestClock, TestTemporalContext, TestHolidayProvider
Pragmatic.Temporal.Internationalization Culture-aware display formatting for LocalDateTime/ZonedDateTime via Pragmatic.Internationalization
Pragmatic.Temporal.Analyzers / .CodeFixers Diagnostics PRAG0900-0904: DateTime.Now/Today instead of IClock, a DateTime without a Kind, a DateTimeOffset compared with relational operators, with fixes

Installation

dotnet add package Pragmatic.Temporal

Quick Start

using Pragmatic.Temporal.Types;

var checkIn  = new LocalDate(2026, 6, 1);
var checkOut = checkIn.AddDays(3);                 // calendar-correct
int nights   = checkOut.DaysBetween(checkIn);       // 3

// Inject IClock instead of DateTime.Now → deterministic tests
public class BookingService(IClock clock)
{
    // IClock.Today is a DateOnly; LocalDate converts both ways, so name the type you compare in
    public bool IsPast(LocalDate date) => date < (LocalDate)clock.Today;
}

Full walkthrough: Getting Started.

Status

Stable within 1.0.0-alpha: the type set, calendar/business-day arithmetic, DST handling, and the JSON/EF Core/ASP.NET integrations are settled. See the roadmap.

Documentation

Guide What you'll learn
Concepts Type = scope, IClock, the mental model, NodaTime comparison
Getting Started First temporal types, arithmetic, injecting IClock
Core Types LocalDate/LocalTime/LocalDateTime/ZonedDateTime/Duration/…: full reference
Business Days Holiday providers, business-day arithmetic, cron
DST Handling Ambiguous/non-existent local times, safe conversions
Testing TestClock and deterministic time
JSON Integration System.Text.Json converters, wire formats, Minimal API setup
EF Core Integration Value converters, column mappings, temporal query extensions
ASP.NET Core Integration Middleware, timezone detection, model binding
Common Mistakes The most frequent date/time pitfalls
Troubleshooting Problem/solution guide

Requirements

  • .NET 10.0+

License

Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Temporal is MIT-licensed.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.6 55 11/21/2026
1.0.0-alpha.5 52 11/21/2026
1.0.0-alpha.4 61 11/16/2026
1.0.0-alpha.3 69 10/17/2026
1.0.0-alpha.2 66 10/12/2026
1.0.0-alpha.1 79 10/3/2026