StoneKit.Core.Structs.DateRange 1.24.703.164603

There is a newer version of this package available.
See the version list below for details.
dotnet add package StoneKit.Core.Structs.DateRange --version 1.24.703.164603
                    
NuGet\Install-Package StoneKit.Core.Structs.DateRange -Version 1.24.703.164603
                    
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="StoneKit.Core.Structs.DateRange" Version="1.24.703.164603" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StoneKit.Core.Structs.DateRange" Version="1.24.703.164603" />
                    
Directory.Packages.props
<PackageReference Include="StoneKit.Core.Structs.DateRange" />
                    
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 StoneKit.Core.Structs.DateRange --version 1.24.703.164603
                    
#r "nuget: StoneKit.Core.Structs.DateRange, 1.24.703.164603"
                    
#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 StoneKit.Core.Structs.DateRange@1.24.703.164603
                    
#: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=StoneKit.Core.Structs.DateRange&version=1.24.703.164603
                    
Install as a Cake Addin
#tool nuget:?package=StoneKit.Core.Structs.DateRange&version=1.24.703.164603
                    
Install as a Cake Tool

StoneKit.Core.Structs.DateRange

DateRange is a lightweight C# struct that represents a range of dates, providing various functionalities such as checking for inclusion of a date within the range, calculating duration, checking for overlaps, and more.

Installation

You can install StoneKit.Core.Structs.DateRange via NuGet Package Manager:

PM> Install-Package StoneKit.Core.Structs.DateRange

Usage

 // Create a date range from January 1, 2023 to December 31, 2023
 var range = new DateRange(new DateTime(2023, 1, 1), new DateTime(2023, 12, 31));
 
 // Calculate duration in days
 double durationInDays = range.TotalDays();
 Console.WriteLine($"Duration in days: {durationInDays}");
 
 // Check if a specific date falls within the date range
 DateTime dateToCheck = new DateTime(2023, 6, 15);
 bool isIncluded = range.IncludesDate(dateToCheck);
 Console.WriteLine($"Is {dateToCheck} included in the date range? {isIncluded}");

Features

  • DateRange Struct: Represents a range of dates with optional start and end dates.
  • Extension Methods: Provides a set of extension methods to enhance the functionality of the DateRange struct:
    • Duration(): Calculates the duration between two dates.
    • OverlapsWith(): Checks if two date ranges overlap.
    • Intersection(): Calculates the intersection of two date ranges.
    • Union(): Calculates the union of two date ranges.
    • Shift(): Shifts the date range by a specified duration.
    • IsEmpty(): Checks if the date range is empty (has no duration).
    • IsInfinite(): Checks if the date range is infinite (has no end date).
    • TotalDays(): Gets the duration of the date range in days.
    • Hours(): Gets the duration of the date range in hours.
    • Minutes(): Gets the duration of the date range in minutes.
    • Seconds(): Gets the duration of the date range in seconds.
    • TotalMilliseconds(): Gets the duration of the date range in milliseconds.

Contributions

Contributions and feedback are welcome! Feel free to submit issues, feature requests, or pull requests on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

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
2024.1.1.391401 176 10/5/2024
2024.1.1.305385 136 8/5/2024
2024.1.1.268769 129 7/9/2024
2024.1.1.261673 153 7/4/2024
2024.1.1.261665 152 7/4/2024
2024.1.1.261631 159 7/4/2024
2024.1.1.260673 145 7/3/2024
2024.1.1.260489 159 7/3/2024
2024.1.1.260485 133 7/3/2024
1.24.703.180756 165 7/3/2024
1.24.703.164603 153 7/3/2024
1.24.703.121207 145 7/3/2024
1.24.626.192706 145 6/26/2024
1.24.612.859 130 6/11/2024
1.24.611.233127 135 6/11/2024
1.24.611.232752 141 6/11/2024
1.24.603.121931 144 6/3/2024
1.24.317.170729 161 3/17/2024
1.24.317.170542 169 3/17/2024
1.24.317.164648 163 3/17/2024
1.24.317.161354 162 3/17/2024