Nepali Date Python - Changelog
List of Changes of all versions of Nepali Date Python
[1.0.0] - 2026-03-17
Added
- Initial Release
- Complete Nepali Date library for Python
- Ported from TypeScript implementation with Python-specific optimizations
- Core date conversion between BS (Bikram Sambat) and AD (Anno Domini)
- Date arithmetic operations (add/subtract days, months, years)
- Date comparison and validation
- Formatting and parsing utilities
- Nepali calendar utilities
Features
Date Conversion
- Convert between Nepali (BS) and English (AD) dates
- Accurate conversion algorithm for years 2000 BS to 2100 BS
- Support for historical and future date conversions
Date Manipulation
- Add or subtract days, months, and years
- Get start/end of day, week, month, year
- Navigate between dates with intuitive methods
- Handle edge cases and month overflow correctly
Date Formatting
- Format dates in various Nepali and English formats
- Custom format strings support
- Localized month and day names in Nepali
Date Validation
- Validate Nepali dates
- Check for leap years in Nepali calendar
- Verify date ranges and boundaries
Utilities
- Get days in month for any Nepali year/month
- Check if date is in the past or future
- Calculate difference between dates
- Clone and compare date objects
Installation
bash
pip install nepali-dateBasic Usage
python
from nepali_date import NepaliDate
# Create a Nepali date
nepali_date = NepaliDate(2081, 5, 15) # 2081 Bhadra 15
# Convert to AD
ad_date = nepali_date.to_ad()
print(ad_date) # 2024-08-31
# Create from AD date
from datetime import date
nepali_from_ad = NepaliDate.from_ad(date(2024, 8, 31))
print(nepali_from_ad) # 2081-05-15
# Date arithmetic
tomorrow = nepali_date.add_days(1)
next_month = nepali_date.add_months(1)
next_year = nepali_date.add_years(1)
# Formatting
formatted = nepali_date.format("%Y-%m-%d") # 2081-05-15
nepali_formatted = nepali_date.format_nepali() # २०८१-०५-१५
# Validation
is_valid = NepaliDate.is_valid_date(2081, 5, 15) # True
days_in_month = NepaliDate.days_in_month(2081, 5) # 31