NepaliCalendar.Lib 1.0.0

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

NepaliCalendar.Lib

A .NET 4.8 library for converting between the Nepali (Bikram Sambat) and Gregorian (AD) calendars.

Features

  • Convert AD (Gregorian) to BS (Nepali) date using AdToBs()
  • Convert BS (Nepali) to AD (Gregorian) date using BsToAd()
  • Lightweight and efficient
  • Easy to use in your .NET Framework applications

Installation

You can install the package via NuGet by running the following command in the NuGet Package Manager Console:

Install-Package NepaliCalendar.Lib

Or, you can install it via the .NET CLI:

dotnet add package NepaliCalendar.Lib

If you'd like to use it locally before pushing it to NuGet, you can follow these steps to install it from a local package source (for testing):

nuget install NepaliCalendar.Lib -Source "C:\LocalNuGetPackages"

Usage

Convert AD to BS (Nepali Date) using AdToBs

using System;
using NepaliCalendar.Lib;

public class Program
{
    public static void Main()
    {
        DateTime adDate = new DateTime(2025, 4, 17); // Example AD date
        string nepaliDate = NepaliCalendarConverter.AdToBs(adDate);
        Console.WriteLine($"Nepali Date: {nepaliDate}"); // Example output: 2078/01/04
    }
}

Convert BS to AD (Gregorian Date) using BsToAd

using System;
using NepaliCalendar.Lib;

public class Program
{
    public static void Main()
    {
        string bsDate = "2078/01/04"; // Example BS date
        DateTime adDate = NepaliCalendarConverter.BsToAd(bsDate);
        Console.WriteLine($"Gregorian Date: {adDate.ToShortDateString()}"); // Example output: 2025/04/17
    }
}

Examples

  • AD to BS: Convert a Gregorian date (2025/04/17) to the Nepali date (2078/01/04) using the AdToBs() method.
  • BS to AD: Convert a Nepali date (2078/01/04) to the corresponding Gregorian date (2025/04/17) using the BsToAd() method.

License

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


Contributing

Contributions are welcome! If you'd like to contribute to this project, please fork it, make your changes, and submit a pull request.


Contact

Binod Sapkota


Acknowledgements

  • This project was inspired by the need to handle Nepali (Bikram Sambat) date conversion for Nepali users.
  • Special thanks to Nepali Date Converter API for the initial algorithm.
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • 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.0.0 201 4/17/2025