Soenneker.Extensions.DateTimeOffsets.Days 4.0.140

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Extensions.DateTimeOffsets.Days --version 4.0.140
                    
NuGet\Install-Package Soenneker.Extensions.DateTimeOffsets.Days -Version 4.0.140
                    
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="4.0.140" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.DateTimeOffsets.Days" Version="4.0.140" />
                    
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 4.0.140
                    
#r "nuget: Soenneker.Extensions.DateTimeOffsets.Days, 4.0.140"
                    
#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@4.0.140
                    
#: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=4.0.140
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.DateTimeOffsets.Days&version=4.0.140
                    
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 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 (1)

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

Package Downloads
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
4.0.145 0 9/7/2026
4.0.144 0 9/7/2026
4.0.143 159 9/4/2026
4.0.142 40 9/4/2026
4.0.141 45 9/4/2026
4.0.140 218 9/1/2026
4.0.139 166 8/31/2026
4.0.138 131 8/31/2026
4.0.137 130 8/31/2026
4.0.136 137 8/31/2026
4.0.135 197 8/30/2026
4.0.134 87 8/30/2026
4.0.133 84 8/30/2026
4.0.132 269 8/29/2026
4.0.131 383 8/26/2026
4.0.130 194 8/26/2026
4.0.129 97 8/25/2026
4.0.128 251 8/22/2026
4.0.127 178 8/21/2026
4.0.126 676 8/18/2026
Loading failed

Updated NuGet packages