RangeHumanizer 0.0.1

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

RangeHumanizer

A lightweight, zero-setup range formatter inspired by Humanizer — it makes single values read nicely, this does it for pairs.

Give it two values and it hands back one readable string with the shared parts removed: Jan 3–7, not Jan 3, 2025 – Jan 7, 2025. Works on dates, numbers, and money.

using RangeHumanizer;

DateRange.Describe(new DateOnly(2025, 1, 3),  new DateOnly(2025, 1, 7));   // "Jan 3–7"
DateRange.Describe(new DateOnly(2025, 1, 30), new DateOnly(2025, 2, 2));   // "Jan 30 – Feb 2"
DateRange.Describe(new DateOnly(2024, 12, 30),new DateOnly(2025, 1, 2));   // "Dec 30, 2024 – Jan 2, 2025"

NumberRange.Describe(10, 20);              // "10–20"
NumberRange.Describe(1000, 2000, "N0");    // "1,000–2,000"

MoneyRange.Describe(new Money(10, "$"), new Money(20, "$"));    // "$10–20"
MoneyRange.Describe(new Money(10, "$"), new Money(20, "€"));    // "$10 – €20"

Dates drop what the endpoints share: same month shows it once (Jan 3–7), same year drops the year (Jan 30 – Feb 2), and you only get the full date when nothing lines up. Money shows one currency symbol when both sides match and both when they don't. Equal values collapse to one (5–5 → 5) unless you turn it off.

Install

dotnet add package RangeHumanizer

Targets net6.0 and net8.0. No dependencies.

Options

var opts = new RangeOptions
{
    Culture = CultureInfo.GetCultureInfo("en-US"),
    TightSeparator = "\u2013",     // – (default)
    LooseSeparator = " \u2013 ",   // space – space (default)
    CollapseEqual = true            // "5–5" → "5"
};

NumberRange.Describe(5, 5, options: opts); // "5"

A note on scope

This is the small, no-dependency option. If you need real localization across many languages, Rh.MessageFormat.CldrData is built on the Unicode CLDR standard and does more — it's heavier and uses ICU template strings, but it's the right tool for serious i18n. RangeHumanizer is for when you just want a range to read nicely: no dependencies, AOT- and trimming-safe, plain method calls.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 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 was computed.  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 was computed.  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.
  • net6.0

    • No dependencies.
  • net8.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
0.0.1 117 7/26/2026