Observed since 20 Oct, 19:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A Python package to convert AD dates to BS dates.
A Python library for converting Gregorian calendar (AD) dates to Bikram Sambat (BS) dates used in Nepal.
This library provides functionality to convert dates from the Gregorian calendar (AD) to the Bikram Sambat (BS) calendar system, which is the official calendar of Nepal. The implementation uses a pre-defined lookup table for Nepali calendar data from 1970 BS (1913 AD) to 2082 BS (2026 AD) for accurate conversions.
pip install ad-bs-converter
from datetime import date
from ad_bs_converter import ADToBSConverter
# Create a converter with an AD date
ad_date = date(2023, 5, 15)
converter = ADToBSConverter(ad_date)
# Get the BS date
bs_date = converter.get_bs_date()
print(bs_date) # Output: 2080-2-1
# Get formatted date
formatted_date = converter.get_formatted()
print(formatted_date) # Output: 2080-2-1
# Get Nepali month name
month_name = converter.get_month_name()
print(month_name) # Output: Jestha
The library uses LRU caching to improve performance for repeated conversions.
# Configure cache size when creating a converter
converter = ADToBSConverter(date(2023, 5, 15), cache_size=256)
# Get cache information
cache_info = ADToBSConverter.get_cache_info()
print(cache_info)
# Clear the cache if needed
ADToBSConverter.clear_cache()
The library provides specific error handling for date range validation:
from datetime import date
from ad_bs_converter import ADToBSConverter
from ad_bs_converter.exceptions import ADDateOutOfBoundsError
try:
# Try with a date outside the supported range
converter = ADToBSConverter(date(1900, 1, 1))
except ADDateOutOfBoundsError as e:
print(f"Error: {e}")
The converter supports AD dates from approximately 1913 to 2026, corresponding to BS dates from 1970 to 2082.
For more detailed documentation including:
Please refer to the github link Aayush Dip Giri.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.2.3 | 17 Mar 2025 | 3 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 19:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:726fb8321ca44f7e48a01cb002bcc33513176724c36726900932791ca3a81155