Skip to content
Nuvyntra Labs
All packages

Shared libraries

TimeKit

Business days, month and quarter bounds, Unix time, and IANA zones

Weekend and business-day arithmetic, month and quarter bounds, Unix timestamps, and DateTimeOffset conversion to an IANA time zone. Version 0.1.1 is in source and is not on nuget.org yet.

Install

dotnet add package NuvyntraLabs.NET.TimeKit

Package ID: NuvyntraLabs.NET.TimeKit

NuvyntraLabs.NET.* is a class library, not a Plugin.Maui.* package. The install command applies after 0.1.1 is published. Until then, reference the project in the hub submodule.

Example

date.IsBusinessDay();
date.AddBusinessDays(5);
date.AddBusinessDays(1, calendar);
date.StartOfMonth();
date.EndOfQuarter();
instant.ToUnixTimestamp();
instant.ToTimeZone("Asia/Kolkata");

Overview

NuvyntraLabs.NET.TimeKit covers a weekend rule, a host-supplied holiday set, and an IANA zone. Prefer NodaTime when the host needs a chronology. IsWeekend is Saturday and Sunday and does not consult a calendar. There is no holiday database and no DateTime overload.

Capabilities

  • WeekendCalendar treats Saturday and Sunday as closed. It is the default.
  • HolidayCalendar wraps another calendar and removes a host-supplied set of DateOnly holidays.
  • AddBusinessDays does not count the start date. Zero returns the same date, including a weekend. A negative count walks backward.
  • A calendar that never opens throws InvalidOperationException.
  • StartOfMonth and EndOfQuarter use calendar quarters (Jan–Mar, Apr–Jun, Jul–Sep, Oct–Dec).
  • ToTimeZone calls TimeZoneInfo.FindSystemTimeZoneById. An unknown id throws TimeZoneNotFoundException.

Discussion

Comment on NuvyntraLabs.NET.TimeKit. The thread lives on this component's GitHub repository. Sign in with GitHub — Giscus uses Discussions, Utterances uses Issues.

Issues are not enabled on this repository

Open the conversation on GitHub, or use the Giscus tab if Discussions are available.

Related in Shared libraries