Bikram Sambat 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 anywhere .NET Standard 2.0 runs: .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5–9, Mono, Xamarin, Unity, and MAUI.
dotnet add package NepDate
Install-Package NepDate
<PackageReference Include="NepDate" Version="2.0.6" />
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 8,600× faster than alternatives. Zero heap allocations on both conversion paths. Sub 5 ns BS → AD, sub 14 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 for 2001–2089 BS.
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 5+.
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
Auto parallel processing for 500+ items. Explicit batch-size control for very large datasets.
Struct by Design
readonly partial struct keeps instances on the stack and eliminates GC pressure in high-volume workloads.
Benchmarked, not just advertised
Flat array dictionaries for O(1) lookups and zero heap allocations on both conversion paths. Numbers below come from a fresh BenchmarkDotNet run, not marketing.
BS → AD Nepali to English
| Library | Mean | Ratio | Allocated |
|---|---|---|---|
| NepDate | 1.00× | 0 B | |
| NepaliCalendarBS | 3,176× | 688 B | |
| NepaliDateConverter.Net | 8,164× | 19,968 B | |
| NepaliDateConverter.NETCORE | 8,603× | 20,688 B |
AD → BS English to Nepali
| Library | Mean | Ratio | Allocated |
|---|---|---|---|
| NepDate | 1.00× | 0 B | |
| NepaliCalendarBS | 12× | 32 B | |
| NepaliDateConverter.Net | 4,889× | 19,968 B | |
| NepaliDateConverter.NETCORE | 4,890× | 20,688 B |
BenchmarkDotNet 0.15.8 · .NET 10.0.5 (X64 RyuJIT, AVX2) · 12th Gen Intel Core i5-12500H 3.10 GHz, Windows 11. 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/6/7/8/9, 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 (approximately 1844-04-13 AD) to the last day of 2199/12 BS (approximately 2143-04-12 AD). Calendar metadata (Tithi, holidays, events) is available for 2001 through 2089 BS.
No. NepDate has zero external runtime dependencies. Newtonsoft.Json and System.Text.Json references are internalized using PrivateAssets=all, so they never surface in your dependency graph.
Yes. NepaliDate is a readonly struct, making it inherently immutable and safe for concurrent access. BulkConvert operations use thread-safe parallel processing.
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, covering 2001 through 2089 BS. The data is compiled into the library at build time. Properties return empty/default values for dates outside this range 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
NepDate is free, MIT licensed, and built in spare time. If it saves your project effort, drop a momo. It keeps the library, NepDate Widget, and the docs site actively maintained.
Buy me a momo