NepDate - Bikram Sambat Nepali Date Conversion for .NET, done right.
NepDate is a zero-dependency, stack-allocated struct that brings nanosecond
Bikram Sambat conversions, smart parsing, fiscal year math, and rich calendar metadata
to every .NET application.
Get started in seconds
One command, zero configuration. Works on .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5 and later, Xamarin, Unity, and MAUI.
dotnet add package NepDate
Install-Package NepDate
<PackageReference Include="NepDate" Version="2.1.0" />
Everything you need. Nothing you don't.
One lightweight package with full coverage of Bikram Sambat date operations, built to the same quality bar as System.DateTime.
Blazing Fast
Up to 41,800× faster than other Nepali date libraries. Zero heap allocations on both conversion paths. Under 1 ns BS → AD, under 3 ns AD → BS.
Bidirectional Conversion
Convert between Bikram Sambat and Gregorian in nanoseconds. Both directions, fully supported.
Smart Parsing
Accepts 100+ month-name spellings, Nepali Unicode digits, alternate separators, and short-year inputs.
Rich Formatting
Custom format tokens, Unicode Devanagari digits, long-form Nepali strings, and full IFormattable support.
Fiscal Year Operations
Nepal FY (Shrawan–Ashadh) quarter and boundary calculations, both instance and static.
Calendar Metadata
Built-in Tithi, public holiday flag, and event data in Nepali and English: tithi for 2078-2083 BS, events and holidays for 2077-2083 BS (plus a few days of 2084).
Date Range Operations
Intersection, union, split by month or fiscal quarter, working days, and interval iteration.
Serialization
System.Text.Json, Newtonsoft.Json, and XML. String and object modes. Zero config on .NET 8+.
First-Class .NET Type
IFormattable, IComparable, IEquatable, IParsable, ISpanFormattable, TypeConverter, JsonConverter. Behaves like DateTime.
Zero Dependencies
No external runtime dependencies. Lightweight, self-contained, single-package install.
Bulk Conversion
Converts whole collections in one pass, in input order, at a few nanoseconds per date.
Struct by Design
readonly partial struct keeps instances on the stack and eliminates GC pressure in high-volume workloads.
Benchmarked, not just advertised
One flat month table for O(1) lookups and zero heap allocations on both conversion paths. Measured with BenchmarkDotNet on NepDate 2.1.0: every call converts a different date, so no result can be precomputed.
BS → AD Nepali to English
| Library | Mean | Ratio | Allocated |
|---|---|---|---|
| NepDate | 1.00× | 0 B | |
| NepaliCalendarBS | 18,933× | 688 B | |
| NepaliDateConverter.Net | 40,812× | 20,016 B | |
| NepaliDateConverter.NETCORE | 41,865× | 20,736 B |
AD → BS English to Nepali
| Library | Mean | Ratio | Allocated |
|---|---|---|---|
| NepDate | 1.00× | 0 B | |
| NepaliCalendarBS | 67× | 32 B | |
| NepaliDateConverter.Net | 23,888× | 20,016 B | |
| NepaliDateConverter.NETCORE | 24,770× | 20,736 B |
NepDate 2.1.0 vs 2.0.7 Release over release
| Operation | 2.0.7 | 2.1.0 | Faster | Allocated |
|---|---|---|---|---|
| BS → AD | 6.05 ns | 0.80 ns | 7.5× | 0 B |
| AD → BS | 13.65 ns | 2.72 ns | 5.0× | 0 B |
| Add 1,000 days | 14.69 ns | 2.07 ns | 7.1× | 0 B |
| Add 13 months | 17.39 ns | 1.75 ns | 9.9× | 0 B |
| Strict parse | 19.92 ns | 5.50 ns | 3.6× | 0 B |
ToString() | 13.37 ns | 11.34 ns | 1.2× | 96 B → 48 B |
| Long Nepali date with weekday | 145.7 ns | 27.7 ns | 5.3× | 435 B → 69 B |
| Calendar info for a day | 109.4 ns | 13.6 ns | 8.0× | 50 B |
| Bulk convert 1,000 dates | 36.6 µs | 4.0 µs | 9.1× | 141 KB → 8 KB |
BenchmarkDotNet 0.15.8 · NepDate 2.1.0 · .NET 10.0.12 (X64 RyuJIT, AVX2) · 12th Gen Intel Core i5-12500H 3.10 GHz, Windows 11, one pinned core. Each call converts a different date from a pool of 1,024 (2070–2085 BS). Smaller is better. Bars are scaled to the slowest method per category.
How NepDate compares
A head-to-head feature matrix against the best-known Nepali date libraries on NuGet.
| Feature | NepDate | NepaliDateConverter | NepaliCalendarBS |
|---|---|---|---|
| BS → AD Conversion | ✓ | ✓ | ✓ |
| AD → BS Conversion | ✓ | ✓ | ✓ |
| Zero-allocation BS → AD | ✓ | ✗ | ✗ |
| Smart multi-format parsing | ✓ | ✗ | ✗ |
| Nepali Unicode digit support | ✓ | ✗ | ✗ |
| Fiscal year operations | ✓ | ✗ | ✗ |
| Date range operations | ✓ | ✗ | ✗ |
| Tithi, holidays & events | ✓ | ✗ | ✗ |
| Bulk conversion | ✓ | ✗ | ✗ |
| JSON serialization | ✓ | ✗ | ✗ |
| XML serialization | ✓ | ✗ | ✗ |
| IFormattable / IComparable | ✓ | ✗ | ✗ |
| TypeConverter (model binding) | ✓ | ✗ | ✗ |
| .NET Standard 2.0 | ✓ | ✓ | ✓ |
| Actively maintained | ✓ | ~ | ~ |
Frequently asked questions
NepDate targets .NET Standard 2.0, which means it works with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5 and later, Xamarin, Unity, and MAUI. It also ships a net8.0 target for newer API features like IParsable and ISpanFormattable.
NepDate supports Bikram Sambat dates from 1901/01/01 BS (1844-04-11 AD) to the last day of 2199/12 BS (2143-04-15 AD). Tithi is available for 2078 through 2083 BS, events and public holidays for 2077 through 2083 BS (plus a few days of 2084).
No. NepDate has no NuGet dependencies. Newtonsoft.Json and System.Text.Json are referenced with PrivateAssets=all, so they are not added to your project. To call ConfigureForNepaliDate(), reference Newtonsoft.Json and, outside .NET 8 and later, System.Text.Json 8.0.5 or later; adding a converter class directly needs only its own library.
Yes. NepaliDate is a readonly struct, making it inherently immutable and safe for concurrent access. BulkConvert operations are safe to call from several threads.
Constructors and Parse throw InvalidNepaliDateFormatException or ArgumentOutOfRangeException for invalid input. Use TryParse for non-throwing validation. Each month's day count is enforced per year (29 to 32 days depending on month and year).
Yes. NepaliDate has a registered TypeConverter that enables automatic model binding in ASP.NET MVC/Web API, WPF, and WinForms property grids. It converts to/from string, int (YYYYMMDD), and DateTime.
Calendar data is compiled from authoritative Bikram Sambat calendar references and cross-verified for accuracy. Tithi is available for 2078 through 2083 BS, events and public holidays for 2077 through 2083 BS (plus a few days of 2084). The data is compiled into the library at build time. Properties return empty/default values for other dates without throwing exceptions.
NepaliDate is a readonly partial struct, which means instances live on the stack rather than the heap. This eliminates garbage collection pressure and makes it extremely efficient for high-throughput scenarios like bulk date processing, large LINQ pipelines, and server-side batch jobs.
Built by contributors like you
NepDate is open source and welcomes pull requests, bug reports, and ideas from anyone.
Support NepDate
If NepDate saves you time every day, consider chipping in a momo. It keeps NepDate and other open source projects free, ad-free, and actively maintained.
Buy me a momo