Dabomase.ItalianDateTimeUtils 1.1.1

dotnet add package Dabomase.ItalianDateTimeUtils --version 1.1.1                
NuGet\Install-Package Dabomase.ItalianDateTimeUtils -Version 1.1.1                
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="Dabomase.ItalianDateTimeUtils" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dabomase.ItalianDateTimeUtils --version 1.1.1                
#r "nuget: Dabomase.ItalianDateTimeUtils, 1.1.1"                
#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.
// Install Dabomase.ItalianDateTimeUtils as a Cake Addin
#addin nuget:?package=Dabomase.ItalianDateTimeUtils&version=1.1.1

// Install Dabomase.ItalianDateTimeUtils as a Cake Tool
#tool nuget:?package=Dabomase.ItalianDateTimeUtils&version=1.1.1                

dabomase-italian-datetime-utils

Introduction

Hello everybody!

My name is Dabomase.ItalianDateTimeUtils and I'm a class library originally written by Davide Borghi. He wrote me because he was bored to copy and paste a static class in every project he was working on.

Another stubborn developer, Massimo Serra, also decided to support Davide with my code.

As a humble, simple and pluggable .NET Standard 2.0 utility library, my role is to help Italian developers or any developer who need support when dealing with Italian holidays (both national and customizable local ones) and work days calculations, which sometimes can be really boring!

Even if I have a good set of unit tests, my developers are committed to extend my features and documentation too, so be patient with me, I promise, they're working hard on these things in their spare time!

For this reason, please, feel free to file comments, open issues and, if you want, even fork my code and open pull requests: only bear in mind to check my open source license to be nice with me.

You can find me on NuGet!

And by the way, if you want to know me better, here's my changelog.

Developers' guide

Installation and prerequisites

The library uses .NET Standard 2.0 to support both .NET Framework and .NET (Core).

You should install the latest version via NuGet:

Install-Package Dabomase.ItalianDateTimeUtils

or via the .NET Core command line interface:

dotnet add package Dabomase.ItalianDateTimeUtils

A general overview

These are the main utility static classes:

  • DateUtils.cs provides DateTime general purpose utility methods;
  • ItalianHolidaysUtils.cs has methods to work with Italian holidays checks;
  • ItalianWorkDaysUtils.cs gives you methods to deal with Italian work days calculations.

While the following classes offers custom extensions to the DateTime type:

  • DateTimeExtensions.cs supports equality check, week and weekends, days of months, quarters and four-month periods;
  • DateTimeHolidaysExtensions.cs adds to the DateTime simple boolean methods to check if given date is an Italian holiday or not.

A quick start

Let's say you want me to check if a given date is an Italian holiday:

bool isHoliday = ItalianHolidaysUtils.IsHoliday(new DateTime(2024, 1, 1));

or you want me to list all yearly Italian holidays or from a selected DateTime range:

var startDate = new DateTime(2024, 3, 15);
var endDate = new DateTime(2025, 12, 15);

var italianHolidaysFor2024 = ItalianHolidaysUtils.GetYearlyHolidays(2024);
var italianHolidaysInRange = ItalianHolidaysUtils.GetHolidaysInRange(startDate, endDate);

When it comes to work days calculations, I can either calculate the number of office days given two dates:

var startDate = new DateTime(2024, 7, 16);
var endDate = new DateTime(2024, 12, 15);

var italianOfficeDaysInRangeCount = 
    ItalianWorkDaysUtils.HowManyOfficeDaysBetweenDates(startDate, endDate);

or even use Func to specify what kind of work days condition you want, either built-in or your own; let me show you:

var startDate = new DateTime(2024, 7, 16);
var endDate = new DateTime(2024, 12, 15);

var italianOfficeDaysInRangeCount = 
    ItalianWorkDaysUtils.HowManyOfficeDaysBetweenDates(startDate, endDate);

var workDaysInRangeExcludingSundaysCount = 
    ItalianWorkDaysUtils.HowManyWorkDaysBetweenDates(
        startDate, endDate, 
        workDaysCondition: ItalianWorkDaysUtils.ExcludeSundaysCondition);

var evenWorkDaysInRangeCount = 
    ItalianWorkDaysUtils.HowManyWorkDaysBetweenDates(
        startDate, endDate, 
        workDaysCondition: ItalianWorkDaysUtils.IncludeOnlyEvenDaysCondition);

var allDaysAsWorkingDaysInRangeCount = 
    ItalianWorkDaysUtils.HowManyWorkDaysBetweenDates(
        startDate, endDate, 
        workDaysCondition: _ => true);

Full user documentation

You can find generated markdown files documenting the available APIs here to foresee more advanced use cases and utilities.

Keep also in mind to regularly check my GitHub repo to see if my developers either packed a new release version or added new use case samples.

Feel free to take a look at the tests project to further explore what I can do for you with real world data sets.

Maintainers' guide

In short

Maintainers can find under the docs directory the following files:

  1. NuGet checklist to help them pack and release a new version of the NuGet package;
  2. Docs generation checklist to guide them generate documents from code using an open source CLI tool;
  3. Generated docs' parent folder.

Code of conduct

Currently used code of conduct can be found here.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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.

Authors' Copyright update for 2025.