Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for Bikram Sambat Calendar (Nepal) #116

Open
pragyanone opened this issue Jul 3, 2022 · 3 comments
Open

Please add support for Bikram Sambat Calendar (Nepal) #116

pragyanone opened this issue Jul 3, 2022 · 3 comments
Labels
enhancement New feature or request to be decided think about if this should be implemented

Comments

@pragyanone
Copy link

pragyanone commented Jul 3, 2022

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.)

@pragyanone
Copy link
Author

pragyanone commented Jul 3, 2022

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:

  1. database
  2. fix a datum day, of which, date in both system is known (1918/4/13 AD = 1975/1/1 BS)
  3. then count the days between a given date and the datum, and do simple addition/subtraction to achieve date in another system. Example:
    3.1 say, you need to convert from 1918/4/14 AD to BS
    3.2 count the days between 1918/4/14 AD and the AD datum, 1918/4/13 AD = 1
    3.3 add the number of days in the BS datum, 1975/1/1 + 1 = 1975/1/2

Notes:

  • The dates are first converted to "days since datum" in step 3.2 for the arithmetic (python functions: ad2days & bs2days).
  • The resulting days from step 3.3 are converted back to dates using days2ad & days2bs.

@pragyanone pragyanone changed the title Please add support for BS date/calendar system [Nepal] Please add support for BS calendar/date system [Nepal] Jul 3, 2022
@Marmo Marmo added enhancement New feature or request to be decided think about if this should be implemented labels Jul 5, 2022
@Marmo
Copy link
Owner

Marmo commented Jul 5, 2022

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.

@pragyanone pragyanone changed the title Please add support for BS calendar/date system [Nepal] Please add support for Bikram Sambat Calendar (Nepal) Aug 18, 2022
@pragyanone
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request to be decided think about if this should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants