Skip to main content

Introduction

Vali-Tempo is a modular .NET ecosystem built for time precision. It provides ten focused NuGet packages covering every aspect of date, time, calendar, duration, scheduling, holidays, and timezone handling — all designed to work together through a single dependency-injection call, or independently as standalone utilities.

Why Vali-Tempo?

Working with time in .NET is surprisingly fragile. The BCL provides DateTime, TimeSpan, and DateTimeOffset — but leaves you to implement common patterns like:

  • Converting between time units with decimal precision
  • Querying workdays considering country-specific holidays
  • Computing accurate ages from birthdates (especially around Feb 29)
  • Building recurring schedules with complex recurrence rules
  • Converting between IANA timezones with DST awareness
  • Enumerating, splitting, and merging date ranges

Vali-Tempo solves all of this with a consistent, DI-friendly API across nine specialized modules, plus a meta-package that wires everything together.

Module Ecosystem

PackageDescriptionKey Type
Vali-TimeTime unit conversions and formatting with decimal precisionIValiTime, IValiDate
Vali-RangeDate range operations: union, intersection, gaps, split, enumerateIValiRange, DateRange
Vali-CalendarWorkday calendar with pluggable holiday provider supportIValiCalendar, CalendarWeek
Vali-DurationHigh-precision decimal Duration value typeValiDuration
Vali-CountDownDeadline tracking, countdown, and progress utilitiesIValiCountDown
Vali-AgeAge calculation from a birthdateIValiAge, AgeResult
Vali-ScheduleFluent builder for recurring schedulesIValiSchedule
Vali-Holiday35+ country holiday data with Easter-based movable holidaysIValiHoliday, HolidayInfo
Vali-TimeZone45+ curated IANA timezone conversion with DST supportIValiTimeZone, ValiZoneInfo
Vali-TempoMeta-package — includes all 9 modules above

Architecture Overview

All nine services are registered as singletons in the DI container. They have no shared mutable state between calls, making them safe for concurrent use across the application lifetime.

AddValiTempo()
├── IValiTime (Vali-Time)
├── IValiDate (Vali-Time)
├── IValiRange (Vali-Range)
├── IValiCalendar (Vali-Calendar)
├── IValiCountDown (Vali-CountDown)
├── IValiAge (Vali-Age)
├── IValiSchedule (Vali-Schedule)
├── IValiHoliday (Vali-Holiday)
└── IValiTimeZone (Vali-TimeZone)
Module independence

Each package can also be installed and used independently. You do not need the meta-package to use just one module.

DI Setup

Install the meta-package:

dotnet add package Vali-Tempo

Register all services in Program.cs:

builder.Services.AddValiTempo();

That single call registers all nine services. You can now inject any of them:

public class ReportService(
IValiDate date,
IValiAge age,
IValiHoliday holiday,
IValiTimeZone tz)
{
public void GenerateReport(DateTime birthdate, DateTime deadline)
{
var userAge = age.Years(birthdate);
var daysLeft = date.Diff(DateTime.Today, deadline, TimeUnit.Days);
var isHoliday = holiday.IsHoliday(deadline, "PE");
var localTime = tz.Convert(deadline, "America/Lima");
}
}

Key Features at a Glance

  • Decimal precision — time conversions use decimal arithmetic, avoiding floating-point drift
  • Value typesDateRange and ValiDuration are structs; no heap allocation for common operations
  • DI-first design — every service is registered as an interface, making testing trivial
  • Holiday intelligence — Easter-based movable holidays computed algorithmically for 35+ countries
  • IANA timezone support — 45+ curated zones with DST, offset diff and instant comparison
  • Fluent scheduling — chain Every().On().At().StartingFrom() to express complex recurrence rules
  • Composable ranges — union, intersection, expand, shrink, split, enumerate with a single method chain

Next Steps