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

Support Hindu calendars (modern) #851

Closed
MenoData opened this issue Dec 21, 2018 · 8 comments
Closed

Support Hindu calendars (modern) #851

MenoData opened this issue Dec 21, 2018 · 8 comments

Comments

@MenoData
Copy link
Owner

Links:

Dershovitz/Reingold also offers a valuable source of algorithms.

@SiddharthaAnand
Copy link

Hi @MenoData I would like to start working on this if no one else is working on it?

@MenoData
Copy link
Owner Author

MenoData commented Oct 1, 2019

@SiddharthaAnand Thanks for feedback. Well, during the last months I had no time. But I think I will soon start working. Helpful contributions can be either on the level of internationalization, especially hindi scripts of month names and era names are highly welcome. The other field of work is the calendar algorithm itself, technically represented by an implementation of the interface CalendarSystem. As far as I have understood the Hindu calendar, there are several variants. The source of Dershovitz/Reingold describes several variants. So the idea to realize the Hindu calendar as an implementation of the interface CalendarVariant as member of a CalendarFamily is suggesting itself.

What would you like to contribute? Personally I would start with enums or primitives of Hindu months and eras as first brick stones including translations. Latter one (translations) are important and harder to realize because the CLDR repository of unicode consortium has NO resources for the Hindu calendar.

@SiddharthaAnand
Copy link

Hi @MenoData Thanks for the description. I would like to first go over how the other calendar systems have been implemented and then suggest how we can go about the hindu calendar implementation and how it can be done. Do you have any other sources to see how and what variants of calendars are there in hindi.

MenoData added a commit that referenced this issue Oct 8, 2019
see issue #851
@MenoData
Copy link
Owner Author

MenoData commented Oct 8, 2019

I have now created the new branch "hindu" and implemented the most important eras according to the book Dershovitz/Reingold ("Calendrical calculations", 5th ultimate edition). Latter one is also my main source for the implementation of the calendrical algorithms. Those 6 eras I have now introduced also describe the different variations of hindu calendar. Currently I tend to identify about 6 variants with a preferred era (according to what I have specified in the commit). That is: Kali Yuga (for an ancient old Hindu calendar variant), Vikrama Samvat (Northern India), Saka (for the rest), Kollam (Malayalam calendar), Bengal (West Bengal) and Nepalese.

The Hindu months can be based on the already existing enum IndianMonth, but must be enhanced for representing leap forms (using the term "adhika" etc.). So I have to commit more on this area, although the text forms of the months are fortunately already there.

About the general structure of the algorithms: We need - per variant - a bijective mapping from the count of days since 1972-01-01 to a quintuple: [year, month, leap-month, day, leap-day]. A new primitive called HinduMonth can encapsulate the two parts "month" (as IndianMonth) and "leap-month" (as boolean flag). About the "day-of-month": This is complex as some days can happen twice (with the same number) or be left out (with a gap in the numbering). But the book of Dershovitz/Reingold should be sufficient to model it.

Furthermore, for example the Nepalese calendar variant is also available as table driven mapping (so useable for test purposes although the range of dates is pretty small). Maybe I can also find a table of test data for the Vikrama Samvat calendar.

@MenoData
Copy link
Owner Author

MenoData commented Oct 8, 2019

Forgotten to mention that every era is associated with a solar and a lunisolar calendar so we really talk about 12 variants. Although the solar calendars only need triple state (year, month, day without leaps) we can use quintuples where the leap-flags are always set to false. This design allows to unify both solar and lunisolar calendar systems in one class.

@SiddharthaAnand
Copy link

@MenoData
Do you have the soft copy of the book by Dershovitz/Reingold. I want to through it before implementing any of the algorithms.

MenoData added a commit that referenced this issue Dec 9, 2019
@MenoData
Copy link
Owner Author

MenoData commented Dec 9, 2019

@SiddharthaAnand There is no (legal) soft copy of the book by Dershovitz/Reingold, so I had to buy it. However, there is an older version of the part related to modern hindu calendar present in internet, namely:

http://www.cs.tau.ac.il/~nachum/calendar-book/papers/hindu-paper.pdf

Meanwhile (just now) I have started the implementation. Please have a look at the hindu branch and especially the class HinduVariant with the method getCalendarSystem() whose implementation is not yet there. IMHO the most simple implementation would be the solar and the standard amanta calendar for the old Hindu rule ARYA_SIDDHANTA (the old Hindu calendar in the book of Dershovitz/Reingold).

It is not easy to keep the overview of the confusing complexity of Hindu calendar family but I think I have found a reasonable way to structure the different variants, see the class mentioned above. As side note for possible enhancements: I can imagine to add an extra member to the class HinduVariant describing the location as reference for the astronomical calculations (usually it should be Ujjain) and another boolean member which asks for modern astronomical calculations instead of the old rules of Surya Siddhanta.

MenoData added a commit that referenced this issue Jan 5, 2020
MenoData added a commit that referenced this issue Jan 7, 2020
MenoData added a commit that referenced this issue Jan 7, 2020
MenoData added a commit that referenced this issue Jan 7, 2020
MenoData added a commit that referenced this issue Jan 16, 2020
MenoData added a commit that referenced this issue Jan 17, 2020
MenoData added a commit that referenced this issue Jan 19, 2020
MenoData added a commit that referenced this issue Jan 27, 2020
MenoData added a commit that referenced this issue Feb 5, 2020
MenoData added a commit that referenced this issue Feb 12, 2020
MenoData added a commit that referenced this issue May 12, 2020
MenoData added a commit that referenced this issue May 12, 2020
MenoData added a commit that referenced this issue May 16, 2020
see issue #851
MenoData added a commit that referenced this issue May 17, 2020
MenoData added a commit that referenced this issue May 17, 2020
MenoData added a commit that referenced this issue May 22, 2020
MenoData added a commit that referenced this issue May 22, 2020
MenoData added a commit that referenced this issue May 31, 2020
MenoData added a commit that referenced this issue Jun 12, 2020
MenoData added a commit that referenced this issue Jun 12, 2020
MenoData added a commit that referenced this issue Jun 15, 2020
MenoData added a commit that referenced this issue Jun 28, 2020
MenoData added a commit that referenced this issue Jun 30, 2020
MenoData added a commit that referenced this issue Jul 2, 2020
MenoData added a commit that referenced this issue Jul 5, 2020
MenoData added a commit that referenced this issue Jul 5, 2020
MenoData added a commit that referenced this issue Jul 8, 2020
MenoData added a commit that referenced this issue Jul 9, 2020
MenoData added a commit that referenced this issue Jul 12, 2020
see issue #851
MenoData added a commit that referenced this issue Jul 12, 2020
MenoData added a commit that referenced this issue Jul 13, 2020
MenoData added a commit that referenced this issue Jul 14, 2020
MenoData added a commit that referenced this issue Jul 17, 2020
@MenoData
Copy link
Owner Author

Finally the algorithmic variants of modern Hindu calendars are implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants