Skip to main content
.NETStandard2.0

Fix egregiously broken or missing functionality in NodaTime.

Published
Apr 3, 2026
6mo ago
Total Downloads
10.4K
10,384

Install

dotnet add package Unfucked.DateTime --version 0.0.1-beta.4
ProductVersions
.NET Standard
netstandard2.0

README

🧰 Unfucked.DateTime

NuGet GitHub Actions Testspace Coveralls

Fix egregiously missing functionality in NodaTime. Inspired by Joda-Time.

Unfuck your house

Installation

dotnet package add Unfucked.DateTime
using Unfucked;

Usage

  • Absolute value of a Duration
    ZonedDateTime a, b;
    Duration abs = (a - b).Abs();
    
  • Get midnight from a ZonedDateTime as a ZonedDateTime, Period, or Duration
    ZonedDateTime now = SystemClock.Instance.InTzdbSystemDefaultZone().GetCurrentZonedDateTime();
    ZonedDateTime midnight = now.AtStartOfDay();
    Duration sinceMidnight = now.LocalDateTime.TimeOfDay.ToDurationSinceStartOfDay();
    Period sinceMidnight2 = now.LocalDateTime.TimeOfDay.ToPeriodSinceStartOfDay();
    
  • Convert time zone offset to hours
    double hours = DateTimeZoneProviders.Tzdb["America/Los_Angeles"].GetUtcOffset(SystemClock.Instance.GetCurrentInstant()).ToHours();
    
  • Compare two OffsetDateTimes to see which one happens first
    OffsetDateTime a, b;
    bool isBefore = a.IsBefore(b);
    isBefore = !b.IsAfter(a);
    
  • More succinct and interchangeable way to define standard TimeSpan, Period, and Duration instances by force casting integral numbers to or constructing Milliseconds, Seconds, Minutes, Hours, and Days, all of which implicitly convert to TimeSpan, Period, and Duration
    TimeSpan t = (Seconds) 3;
    

All Unfucked libraries

Changes from Previous Version

No structural changes between v0.0.1-beta.3 and v0.0.1-beta.4.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.