Soenneker.Extensions.DateTimeOffsets.Days 11.0.206

Prefix Reserved
dotnet add package Soenneker.Extensions.DateTimeOffsets.Days --version 11.0.206
                    
NuGet\Install-Package Soenneker.Extensions.DateTimeOffsets.Days -Version 11.0.206
                    
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="Soenneker.Extensions.DateTimeOffsets.Days" Version="11.0.206" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.DateTimeOffsets.Days" Version="11.0.206" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.DateTimeOffsets.Days" />
                    
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 Soenneker.Extensions.DateTimeOffsets.Days --version 11.0.206
                    
#r "nuget: Soenneker.Extensions.DateTimeOffsets.Days, 11.0.206"
                    
#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 Soenneker.Extensions.DateTimeOffsets.Days@11.0.206
                    
#: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=Soenneker.Extensions.DateTimeOffsets.Days&version=11.0.206
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.DateTimeOffsets.Days&version=11.0.206
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.DateTimeOffsets.Days

Computes current, previous, and next day boundaries for DateTimeOffset, either in its stored offset or in a named time zone with UTC results.

Installation

dotnet add package Soenneker.Extensions.DateTimeOffsets.Days

Boundaries in the stored offset

using Soenneker.Extensions.DateTimeOffsets.Days;

DateTimeOffset value = new(2026, 8, 29, 16, 42, 30, TimeSpan.FromHours(-4));

DateTimeOffset start = value.ToStartOfDay();
DateTimeOffset end = value.ToEndOfDay();
DateTimeOffset previousStart = value.ToStartOfPreviousDay();
DateTimeOffset nextEnd = value.ToEndOfNextDay();
Method Result
ToStartOfDay() Midnight on the stored calendar date
ToEndOfDay() One tick before the next stored date
ToStartOfPreviousDay() Midnight on the previous stored date
ToEndOfPreviousDay() One tick before the current stored date
ToStartOfNextDay() Midnight on the next stored date
ToEndOfNextDay() One tick before the date after next

These methods preserve the value's offset and use calendar arithmetic on its existing fields. They do not consult a TimeZoneInfo, so that fixed offset does not automatically change across DST.

Boundaries in a named time zone

TimeZoneInfo eastern = TimeZoneInfo.FindSystemTimeZoneById("America/New_York");
DateTimeOffset instant = new(2026, 8, 29, 18, 0, 0, TimeSpan.Zero);

DateTimeOffset localDayStartUtc = instant.ToStartOfTzDay(eastern);
DateTimeOffset localDayEndUtc = instant.ToEndOfTzDay(eastern);

Time-zone variants determine the instant's local calendar date and return the current, previous, or next local-day boundary with offset +00:00:

  • ToStartOfTzDay() / ToEndOfTzDay()
  • ToStartOfPreviousTzDay() / ToEndOfPreviousTzDay()
  • ToStartOfNextTzDay() / ToEndOfNextTzDay()

Any input offset is accepted because DateTimeOffset identifies an instant. A midnight inside a time-zone gap advances minute-by-minute to the first valid local minute. An ambiguous midnight selects the earlier UTC instant. End values are one tick before the following valid local-day boundary, so 23-hour and 25-hour days are not treated as fixed 24-hour intervals.

Day-of-week mapping

DayOfWeekType day = value.ToDayOfWeekType();

ToDayOfWeekType() maps the System.DayOfWeek of the value's stored calendar date to Soenneker.Enums.DayOfWeek.DayOfWeekType. It does not perform a time-zone conversion first.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Soenneker.Extensions.DateTimeOffsets.Days:

Package Downloads
Soenneker.Extensions.DateRangeType

A collection of helpful DateRangeType enum extension methods

Soenneker.Extensions.DateTimeOffsets.DayOfWeeks

A collection of helpful DateTimeOffset DayOfWeek extension methods

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.206 0 11/15/2026
11.0.205 50 11/14/2026
11.0.203 179 11/11/2026
11.0.202 106 11/11/2026
11.0.201 151 11/11/2026
11.0.200 105 11/11/2026
11.0.199 131 11/10/2026
11.0.198 370 11/3/2026
11.0.197 159 11/3/2026
11.0.196 155 11/3/2026
11.0.195 225 10/27/2026
11.0.194 121 10/27/2026
11.0.193 175 10/26/2026
11.0.192 120 10/26/2026
11.0.191 118 10/26/2026
11.0.190 109 10/26/2026
11.0.189 124 10/26/2026
11.0.188 144 10/26/2026
11.0.187 105 10/26/2026
4.0.186 791 10/15/2026
Loading failed

Update dependency Soenneker.Extensions.DateTimeOffsets to 11.0.207 (#356)