techgaun / ad-bs-converter.py

Python implementation of https://github.com/techgaun/ad-bs-converter
Apache License 2.0
5 stars 3 forks source link

End date #1

Open SimonAstani opened 6 years ago

SimonAstani commented 6 years ago

As in js version. The python scripts doesnot give end date of the nepali month...

techgaun commented 6 years ago

Hey @SimonAstani what do you mean by end date of the Nepali month. Maybe an example will be clearer. I can take a look at this if I understand the issue. Thanks!

SimonAstani commented 6 years ago

Its not an issues either. In js version we can get totalDaysInMonth: '३२'. But it is missing in python package. I have to write some custom function to get the end nepali date..

def nepali_end_date(date):
    bs_dict = adbs.ad_to_bs(date)
    end_date = get_end_of_month(bs_dict['en']['year'], bs_dict['en']['month'])
    nepali_end_date = str(bs_dict['en']['year']) + "/" + str(bs_dict['en']['month']) + "/" + str(end_date)
    return nepali_end_date

def get_end_of_month(npyear,month):
    year_data = calendar_data.get(npyear)
    month_index = month - 1
    end_of_month = year_data[month_index]
    return end_of_month

I used you library for this solo purpose. But it was lacking to get nepali end date.Hope you get it.

techgaun commented 6 years ago

@SimonAstani ah I see thanks for the detail. I will probably add that coming weekend and make a release. If you wanna go ahead and provide a PR with a fix, feel free to do so.