Closed ghost closed 4 years ago
The problem is you can't use python's datetime module to create BS date.
return datetime.date(bs_year, bs_month, bs_day)
python datetime module is only for AD Dates. 2072-04-31 throws exception because April(4th month) always contains 30 days in AD date. Whereas 2072-04-31 is perfectly valid date for BS date.
ya thats why i asked if you know a solution to this? Is there any other datetime object i can use for localized date storage?
For localized date storage, you can just create your object or It may be a new feature here in this library. Can you specify what features do you want for the object?
I would like to store the nepali date in an abstract class which extends datetime.date Sort of like this,
class ndatetime(detetime.date):
def __init__(self, *args, **kwargs):
pass
something like that
The feature has been implemented on 81d8c42f2016efe5f2ef1a6d8708d069cc7b9fa6 and will be shipped on v0.3.0
The error is in the last line when the datetime object is returned. The problem, afaik is that the BS month-days are incompatable with the AD month dates, i.e the no. of days per month in BS.