Open pragyanone opened 2 years ago
adbs.py
Summary: You just need to call the functions ad2bs
& bs2ad
for the conversions.
Explanation: Unlike the AD calendar, the BS calendar doesn't have fixed number of days in a month. (Yes, in AD calendar, February has 29 days every leap year but in BS calendar, there doesn't seem to be a straight algorithm.) This has to do with the fact that BS is a lunar calendar, whereas AD is a solar one.
So, for BS calendar, we basically have a database of days in months for several future years ahead. (bs_data
python string).
Algorithm:
Notes:
ad2days
& bs2days
).days2ad
& days2bs
.Hi @pragyanone , I would really like to support other calendar systems. What I would not like to do is to re-program many components that are normally provided by Android, like the date picker.
Doing a quick search I could not find info about if Android supports non-Gregorian calendars or not.
Hi @Marmo, I've a workaround that will support all calendars worldwide. You could provide an option to remove date validations! Then in the default transaction entry, just increment days in every month; if it's a new month, user will change the date to next month-day1. Then, again keep incrementing the date.
I know this feels unethical, but it will support any calendar.
In my country, Nepal, Bikram Sambat calendar is used instead of the ubiquitous Gregorian system.
Being a small and underdeveloped country, not many international apps support the national calendar system, and the citizens have a hard time to just convert the date between these two systems.
Debitum, in my view, is a great app of its kind.
I, myself have written a python script to convert dates between these two systems. I would like the dev. to add support for BS calendar system.
(will post a brief explanation of my script in the comment below.)