Vali-BusinessHours 1.0.0

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

Vali-BusinessHours

Resolves the simultaneous business-hours overlap window between two IANA timezones — the classic "what time works for both of us" cross-timezone scheduling problem.

Features

  • Pairwise timezone overlap — given a daily business-hours block (TimeOnly start/end) per zone, resolves the UTC window where both are open at once
  • DST-correct — the offset of each zone is resolved at the specific instant evaluated (via Vali-TimeZone), never a cached base offset
  • Midnight-crossing aware — a zone's business hours can map to the calendar day before or after the reference date once projected to the other zone; the overlap search checks all three candidate days
  • Workday-aware variant — OverlapOnWorkday short-circuits to "no overlap" when the reference date isn't a workday in either zone's own Vali-Calendar
  • Composes Vali-Calendar and Vali-TimeZone without coupling either package to the other
  • Compiled targets: net8.0 · net9.0 · net10.0 — compatible with .NET 6+ via NuGet backward compatibility

Installation

dotnet add package Vali-BusinessHours

Compatible with .NET 6, 7, 8, and 9. For new projects, .NET 8 (LTS) or .NET 9 is recommended.

Quick Start

using Vali_BusinessHours.Core;
using Vali_BusinessHours.Models;
using Vali_TimeZone.Core;

IValiTimeZone timeZone = new ValiTimeZone();
IValiBusinessHours businessHours = new ValiBusinessHours(timeZone);

var lima = new BusinessHoursWindow("America/Lima", new TimeOnly(9, 0), new TimeOnly(18, 0));
var madrid = new BusinessHoursWindow("Europe/Madrid", new TimeOnly(9, 0), new TimeOnly(18, 0));

BusinessHoursOverlapResult result = businessHours.Overlap(lima, madrid, new DateTime(2025, 6, 2));

if (result.HasOverlap)
{
    Console.WriteLine($"Overlap (Lima time): {result.StartInZoneA} → {result.EndInZoneA}");
    Console.WriteLine($"Overlap (Madrid time): {result.StartInZoneB} → {result.EndInZoneB}");
}

API Reference

Overlap(BusinessHoursWindow a, BusinessHoursWindow b, DateTime referenceDate)

Resolves the overlap for a calendar date, interpreted in a's timezone.

BusinessHoursOverlapResult Overlap(BusinessHoursWindow a, BusinessHoursWindow b, DateTime referenceDate);

OverlapOnWorkday((BusinessHoursWindow, IValiCalendar) a, (BusinessHoursWindow, IValiCalendar) b, DateTime referenceDate)

Same as Overlap, but requires referenceDate to be a workday in both calendars first — useful when each side has its own holiday calendar.

using Vali_Calendar.Core;
using Vali_Holiday.Core;

IValiCalendar peruCalendar = new ValiCalendar(holidayProvider: HolidayProviderFactory.CreateAll().For("PE"));
IValiCalendar spainCalendar = new ValiCalendar(holidayProvider: HolidayProviderFactory.CreateAll().For("ES"));

var result = businessHours.OverlapOnWorkday(
    (lima, peruCalendar),
    (madrid, spainCalendar),
    new DateTime(2025, 6, 2));

BusinessHoursOverlapResult

Member Meaning
HasOverlap true if the two windows share any instant.
StartUtc / EndUtc The overlap window as absolute UTC instants.
StartInZoneA / EndInZoneA The overlap window projected to the first window's zone.
StartInZoneB / EndInZoneB The overlap window projected to the second window's zone.

All members are null when HasOverlap is false.

v1 Scope

  • Exactly two timezones per call. Three or more zones at once is out of scope for v1.
  • A single daily business-hours block per zone — no recurrence, no per-day exceptions.
  • No automatic holiday filtering inside Overlap — combine with your own IValiCalendar + IHolidayProvider (see OverlapOnWorkday), or filter the reference date yourself.
  • No meeting-scheduling features (no calendars, invitees, or slot negotiation) — this is a calculation primitive, not a scheduling product.

Dependency Injection

// Program.cs
using Vali_BusinessHours.Extensions;
using Vali_TimeZone.Extensions;

builder.Services.AddValiTimeZone();      // IValiBusinessHours resolves IValiTimeZone from the container
builder.Services.AddValiBusinessHours(); // registers IValiBusinessHours as a singleton

License

Licensed under the MIT License. Copyright © 2025 Felipe Rafael Montenegro Morriberon. All rights reserved.

Donations

If this package is useful to you, consider supporting its development:


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 is compatible.  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 is compatible.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Vali-BusinessHours:

Package Downloads
Vali-Tempo

Vali-Tempo is the all-in-one meta-package for the Vali-Tempo ecosystem. Installing it gives you every module — Vali-Time, Vali-Range, Vali-Calendar, Vali-CountDown, Vali-Age, Vali-Holiday, Vali-TimeZone, Vali-Schedule, Vali-Duration, Vali-BusinessHours, and Vali-Bucket — with a single NuGet reference and a single DI registration call.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 135 10/14/2026

Vali-BusinessHours v1.0.0 — initial release: pairwise cross-timezone business-hours overlap (Overlap), workday-aware overlap (OverlapOnWorkday).