Soenneker.Extensions.DateTimeOffsets.Years 11.0.163

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

Year-boundary extensions for DateTimeOffset, including boundaries defined by a supplied time zone.

Installation

dotnet add package Soenneker.Extensions.DateTimeOffsets.Years

Offset-preserving boundaries

Use the ordinary methods when the value's displayed year and existing offset are the intended frame of reference. No time-zone conversion occurs.

using Soenneker.Extensions.DateTimeOffsets.Years;

var value = new DateTimeOffset(2024, 6, 15, 12, 30, 0, TimeSpan.FromHours(-5));

DateTimeOffset start = value.ToStartOfYear();
// 2024-01-01 00:00:00 -05:00

DateTimeOffset end = value.ToEndOfYear();
// 2024-12-31 23:59:59.9999999 -05:00

Previous and next boundaries are available through ToStartOfPreviousYear(), ToEndOfPreviousYear(), ToStartOfNextYear(), and ToEndOfNextYear().

Time-zone year boundaries

Use the Tz methods when the input represents an instant and the supplied time zone determines its local year. Results are UTC DateTimeOffset values with a zero offset.

TimeZoneInfo eastern = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
var instant = new DateTimeOffset(2024, 6, 15, 12, 30, 0, TimeSpan.Zero);

DateTimeOffset startUtc = instant.ToStartOfTzYear(eastern);
// 2024-01-01 05:00:00 +00:00

DateTimeOffset nextStartUtc = instant.ToStartOfNextTzYear(eastern);
// 2025-01-01 05:00:00 +00:00

The time-zone variants are ToStartOfTzYear(), ToEndOfTzYear(), ToStartOfPreviousTzYear(), ToEndOfPreviousTzYear(), ToStartOfNextTzYear(), and ToEndOfNextTzYear().

End methods are inclusive and return one tick before the following year begins. Every time-zone boundary is calculated from that local January 1, so historical offset and dateline changes are respected. A skipped local midnight resolves to the first valid local time, and an ambiguous midnight resolves to its earlier UTC occurrence.

Operations that would pass the DateTimeOffset range return DateTimeOffset.MinValue or DateTimeOffset.MaxValue instead of throwing.

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.Years:

Package Downloads
Soenneker.Extensions.DateRangeType

A collection of helpful DateRangeType enum extension methods

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.163 0 11/15/2026
11.0.162 150 11/11/2026
11.0.161 107 11/11/2026
11.0.160 126 11/11/2026
11.0.159 95 11/11/2026
11.0.158 108 11/11/2026
11.0.157 86 11/11/2026
11.0.156 128 11/10/2026
11.0.155 315 11/3/2026
11.0.154 119 11/3/2026
11.0.153 152 11/3/2026
11.0.152 204 10/27/2026
11.0.151 168 10/26/2026
11.0.150 109 10/26/2026
11.0.149 149 10/26/2026
11.0.148 101 10/26/2026
4.0.147 735 10/15/2026
4.0.146 109 10/15/2026
4.0.145 113 10/14/2026
4.0.144 190 10/14/2026
Loading failed

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