Back to Blog
dotnet

From Nepali Calendar Chaos to Code: Building NepaliCalendarToolkit

April 19, 20258 min min read

"Sushil Ji…" The client's voice was clear with their requirements. "We need separate reports for weekdays, weekends, and holidays."

"No problem," I replied confidently. After all, how hard could it be?

Few days later, my confidence was shattered. In Nepal, government offices follow a Saturday-only weekend system, while private companies take both Saturday and Sunday off. And don't get me started on the holidays…

The Holiday Nightmare

Nepali holidays aren't just fixed dates — they're a beautiful chaos of:

  • Traditional festivals following lunar calendars
  • Government holidays announced last minute
  • Regional variations
  • Public holidays that fall on weekends
I found myself manually creating holiday data, updating them each year, and constantly explaining why our report showed "Maha Shivaratri" as a working day.

Building NepaliCalendarToolkit

I built NepaliCalendarToolkit to solve this:

dotnet add package NepaliCalendarToolkit

Holiday and Weekend Tracking

// Get everything for the year 2082
var holidaysAndWeekends = NepaliCalendarConverter.GetHolidaysAndWeekends(2082);</p><p>// Get just holidays for a specific month
var holidays = NepaliCalendarConverter.GetHolidaysAndWeekends(2082, 1, HolidayOrWeekendEnum.Holidays);

Date Conversion Made Simple

// Nepali to AD
var nepaliDate = new NepaliDate(2082, 1, 1);
var gregorianDate = NepaliCalendarConverter.ConvertToAD(nepaliDate);</p><p>// AD to Nepali
var date = new DateTime(2025, 4, 14);
var convertedNepaliDate = NepaliCalendarConverter.ConvertToNepali(date);

Fiscal Year Operations

// Get fiscal year date range
var fiscalYearRange = NepaliCalendarConverter.GetFiscalYearDateRangeInAD(2082);
// Returns: StartDate: 2025-07-17, EndDate: 2026-07-16</p><p>// Get quarter date range
var quarterRange = NepaliCalendarConverter.GetQuarterDateRangeInAD(2082, 1);

Real-World Use Cases

  • Payroll Systems: Calculate actual working days for salary processing
  • Project Management: Plan timelines considering local holidays
  • Attendance Systems: Differentiate between absences and holidays
  • Reporting Tools: Generate accurate productivity reports
  • Visit the GitHub repo for more examples.

    Share this article

    Tags

    Nepali Calendar .NET NuGet Nepal

    Subscribe to Newsletter

    Get notified about new articles