Soenneker.Extensions.DateTimeOffsets.DayOfWeeks 11.0.185

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

Moves a DateTimeOffset to the strictly previous or next occurrence of a weekday, with optional day boundaries and time-zone-aware UTC results.

Installation

dotnet add package Soenneker.Extensions.DateTimeOffsets.DayOfWeeks
using Soenneker.Extensions.DateTimeOffsets.DayOfWeeks;

DateTimeOffset monday = new(2026, 8, 31, 15, 30, 0, TimeSpan.FromHours(-4));

DateTimeOffset previousFriday = monday.ToPreviousDayOfWeek(DayOfWeek.Friday);
DateTimeOffset nextMonday = monday.ToNextDayOfWeek(DayOfWeek.Monday);
DateTimeOffset previousFridayStart = monday.ToStartOfPreviousDayOfWeek(DayOfWeek.Friday);
DateTimeOffset nextFridayEnd = monday.ToEndOfNextDayOfWeek(DayOfWeek.Friday);

Navigation is strict. If the input is already on the requested weekday, the result is seven days away.

ToPreviousDayOfWeek() and ToNextDayOfWeek() preserve the input time and offset. Start/end variants reset the stored clock fields to midnight or one tick before the following date while preserving that offset. These methods do not apply a named time zone's DST rules.

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

DateTimeOffset nextMondayStartUtc =
    instant.ToStartOfNextTzDayOfWeek(DayOfWeek.Monday, eastern);

DateTimeOffset previousFridayEndUtc =
    instant.ToEndOfPreviousTzDayOfWeek(DayOfWeek.Friday, eastern);

The time-zone variants determine the instant's local date, select the strictly previous or next matching weekday, and return the boundary with offset +00:00:

  • ToStartOfPreviousTzDayOfWeek()
  • ToStartOfNextTzDayOfWeek()
  • ToEndOfPreviousTzDayOfWeek()
  • ToEndOfNextTzDayOfWeek()

Starts resolve local midnight using the zone's rules. A midnight in a gap advances to the first valid local time; an ambiguous midnight selects the earlier UTC instant. Ends are one tick before the next valid local day boundary, so 23-hour and 25-hour days are handled without assuming a fixed 24-hour duration.

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 (1)

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

Package Downloads
Soenneker.Extensions.DateTimeOffsets.Suite

A collection of all of the helpful DateTimeOffset extension methods

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.185 0 11/15/2026
11.0.184 0 11/15/2026
11.0.183 129 11/11/2026
11.0.182 55 11/11/2026
11.0.181 93 11/11/2026
11.0.180 50 11/11/2026
11.0.179 76 11/11/2026
11.0.178 88 11/10/2026
11.0.177 254 11/3/2026
11.0.176 105 11/3/2026
11.0.175 125 11/3/2026
11.0.174 180 10/27/2026
11.0.173 100 10/27/2026
11.0.172 107 10/27/2026
11.0.171 133 10/27/2026
11.0.169 122 10/26/2026
11.0.168 90 10/26/2026
11.0.167 105 10/26/2026
11.0.166 106 10/26/2026
11.0.165 121 10/26/2026
Loading failed

Update dependency Soenneker.Extensions.DateTimeOffsets.Days to 11.0.206 (#337)