NepaliCalendarCore 1.4.0

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

Nepali-English Date Conversion Utility (.NET Core)

This .NET Core project provides utilities for converting dates between the Nepali (Bikram Sambat - BS) and English (Gregorian - AD) calendar systems. It also supports common date arithmetic operations such as adding days, months, and years.

✨ Features

  • 🔄 Convert Nepali date to English date.
  • 🔄 Convert English date to Nepali date.
  • ➕ Add/Subtract days, months, and years in either calendar system.
  • 📅 Display current date in both BS and AD formats.

Convert Nepali date string to AD DateTime

Convert AD DateTime to Nepali date string

Add years or months to a Nepali date

Get day or month count between two Nepali dates

Check if a Nepali year is a leap year

Get month info for a Nepali date

Validate Nepali date format

📦 Tech Stack

  • Language: C#
  • Framework: .NET Core / .NET 6+
  • IDE: Visual Studio 2022+
  • Target Platforms: Windows, Linux (cross-platform compatible)

🚀 Getting Started

Prerequisites

  • .NET SDK (.NET Core 3.1 or later)
  • Visual Studio 2022+ or Visual Studio Code

Clone the Repository

git clone https://github.com/koolkabin/NepaliCalendarCore.git
cd nepali-date-converter

Run the Application

dotnet run

🛠️ Usage

Import the necessary classes

using NepaliCalendar; // Assume this is your namespace
using NepaliCalendar.Utils.NepaliCalendarExtension;

Convert Nepali Date to English

var nepaliDate = "2081/04/10"; // B.S.
DateTime englishDate = nepaliDate.ToAD();
Console.WriteLine("English Date: " + englishDate.ToString("yyyy-MM-dd"));

Convert English Date to Nepali

var english = new DateTime(2025, 7, 25);
string bsDate = english.ToBS();
Console.WriteLine($"Nepali Date: {bsDate.Year}-{bsDate.Month:D2}-{bsDate.Day:D2}");

Add Days, Months, and Years

string original = "2082/04/02"; // B.S. date
string after15Days = original.AddDays(15);
string after2Months = original.AddMonths(2);
string after1Year = original.AddYears(1);

Console.WriteLine("After 15 Days: " + after15Days);
Console.WriteLine("After 2 Months: " + after2Months);
Console.WriteLine("After 1 Year: " + after1Year);

Subtracting Days

string before10Days = original.AddDays(-10);
Console.WriteLine("10 Days Ago: " + before10Days);

📚 Sample Output

Nepali: 2081-04-10
English: 2024-07-25

After Adding 15 Days:
Nepali: 2081-04-25
English: 2024-08-09

📁 Project Structure

/NepaliDateConverter
|-- Program.cs
|-- NepDate.cs
|-- Utils/
    |-- Converter.cs
    |-- NepaliCalendarExtension.cs
|-- README.md

✅ Tests

To run unit tests:

dotnet test

📅 Reference

  • Algorithm based on Government of Nepal calendar datasets

👨‍💻 Author

Kabindra Bakey Email: koolkabin@live.com LinkedIn: LinkedIn

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


---

Let me know if you'd like this tailored for a Web API, NuGet package, or console library format. If you want, I can also autogenerate it based on your `.csproj` and source code.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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.
  • net5.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
1.4.0 387 7/25/2025
1.3.0 662 2/10/2022
1.2.0 523 2/10/2022
1.1.0 507 2/10/2022
1.0.0 497 2/9/2022

Pattern Check addition
Fix for Year 2082