PH.WorkingDaysAndTime
2.0.0
See the version list below for details.
dotnet add package PH.WorkingDaysAndTime --version 2.0.0
NuGet\Install-Package PH.WorkingDaysAndTime -Version 2.0.0
<PackageReference Include="PH.WorkingDaysAndTime" Version="2.0.0" />
paket add PH.WorkingDaysAndTime --version 2.0.0
#r "nuget: PH.WorkingDaysAndTime, 2.0.0"
// Install PH.WorkingDaysAndTime as a Cake Addin #addin nuget:?package=PH.WorkingDaysAndTime&version=2.0.0 // Install PH.WorkingDaysAndTime as a Cake Tool #tool nuget:?package=PH.WorkingDaysAndTime&version=2.0.0
PH.WorkingDaysAndTime - V.2.0.0
A tiny c# utility for calculating work days and work time. The code is written in .NET C#.
The tool is useful for calculate difference between two dates of workdays, to plan projects excluding holidays and absences. Is also a simple starting-point to addons to estimate the date of the end of a job.
The application works only counting the dates forward and it is assumed that the date entered as the first parameter is a working day.
Features
- can add n work-days to a DateTime;
- can add n work-hours to a DateTime;
- can get a List of work-DateTime between 2 dates;
Code Examples
AddWorkingDays(DateTime start, int days)
//this is the configuration of a work-week: 8h/day from monday to friday
var wts1 = new WorkTimeSpan()
{ Start = new TimeSpan(9, 0, 0), End = new TimeSpan(13, 0, 0) };
var wts2 = new WorkTimeSpan()
{ Start = new TimeSpan(14, 0, 0), End = new TimeSpan(18, 0, 0) };
var wts = new List<WorkTimeSpan>() { wts1, wts2 };
var week = new WeekDaySpan()
{
WorkDays = new Dictionary<DayOfWeek, WorkDaySpan>()
{
{DayOfWeek.Monday, new WorkDaySpan() {TimeSpans = wts}}
,
{DayOfWeek.Tuesday, new WorkDaySpan() {TimeSpans = wts}}
,
{DayOfWeek.Wednesday, new WorkDaySpan() {TimeSpans = wts}}
,
{DayOfWeek.Thursday, new WorkDaySpan() {TimeSpans = wts}}
,
{DayOfWeek.Friday, new WorkDaySpan() {TimeSpans = wts}}
}
};
//this is the configuration for holidays:
//in Italy we have this list of Holidays plus 1 day different on each province,
//for mine is 1 Dec (see last element of the List<HoliDay>).
var italiansHoliDays = new List<HoliDay>()
{
new EasterMonday(),new HoliDay(1, 1),new HoliDay(6, 1),
new HoliDay(25, 4),new HoliDay(1, 5),new HoliDay(2, 6),
new HoliDay(15, 8),new HoliDay(1, 11),new HoliDay(8, 12),
new HoliDay(25, 12),new HoliDay(26, 12)
, new HoliDay(1, 12)
};
//instantiate with configuration
var utility = new WorkingDaysAndTimeUtility(week, italiansHoliDays);
//lets-go: add 3 working-days to Jun 1, 2015
var result = utility.AddWorkingDays(new DateTime(2015,6,1), 3);
//result is Jun 5, 2015 (see holidays list)
GetWorkingDaysBetweenTwoDateTimes(DateTime start, DateTime end, bool includeStartAndEnd = true)
var start = new DateTime(2015, 12, 31, 9, 0, 0);
var end = new DateTime(2016, 1, 7, 9, 0, 0);
//omitted configurations and holidays...
var utility = new WorkingDaysAndTimeUtility(weekConf, GetItalianHolidays());
//r is a workdays List<DateTime> between Dec 31 and Jan 7.
var r = utility.GetWorkingDaysBetweenTwoDateTimes(start, end);
Product | Versions 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. |
.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. |
-
.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.
Version | Downloads | Last updated |
---|---|---|
2.0.13 | 1,102 | 5/9/2023 |
2.0.12 | 358 | 1/19/2023 |
2.0.11 | 4,766 | 6/27/2022 |
2.0.10 | 3,407 | 8/6/2021 |
2.0.9 | 370 | 8/2/2021 |
2.0.8 | 353 | 7/14/2021 |
2.0.7 | 355 | 7/13/2021 |
2.0.6 | 11,277 | 3/30/2021 |
2.0.5 | 12,480 | 6/29/2020 |
2.0.4 | 12,423 | 11/15/2018 |
2.0.3 | 682 | 11/15/2018 |
2.0.2 | 693 | 11/15/2018 |
2.0.1 | 693 | 11/14/2018 |
2.0.0 | 705 | 11/13/2018 |