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

Jewish calendar new #18

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Jewish calendar new #18

wants to merge 11 commits into from

Conversation

gautschr
Copy link
Collaborator

Number of possible months in a year has to be adjusted in order to correct Jewish month lengths correctly.

@tobiasschweizer
Copy link
Collaborator

tobiasschweizer commented Sep 10, 2019

export class JewishCalendarDate extends JDNConvertibleCalendar {

        public readonly calendarName = JDNConvertibleCalendar.jewish;

        // Determine the number of months of a certain Jewish year
        public readonly monthsInYear = 13;

monthsInYear has to be a method that takes the year as an argument. In case of the Jewish calendar, it has to call JDNConvertibleConversionModule.JewishCharact(jewishYear). For the other calendars, 12 will be returned.

@tobiasschweizer
Copy link
Collaborator

tobiasschweizer commented Sep 10, 2019

handleMonthTransposition has to determine the number of months in each year

// get remaining months to shift: max. this.monthsInYear - 1
            const monthsToShift = Math.abs(months) % this.monthsInYear;

The following cases have to be handled correctly:

  1. current month + months is > 6 or < 8:
    • if current year has 12 months, there is no month 7. If the current month is 6 and months is 1, then it has to shift to month 8. If the current month is 8 and months is -1, then it has to shift to month 6.
  2. modulo for several years:
    • get year of given calendarDate (current year)
    • get number of months (nmo) for current year using JDNConvertibleConversionModule.JewishCharact(jewishYear)
    • if months <= nmo -> do shift considering 1.
    • if months > nmo -> get number of months (nmo) for following/previous year, repeat above until months exceeded

@emargareten
Copy link

@tobiasschweizer any updates for this PR?

@tobiasschweizer
Copy link
Collaborator

@tobiasschweizer any updates for this PR?

No, unfortunately not. Sadly, I don't have any time to work on this PR. Could you help in some way? Even just figuring out the algorithm for the months would be a big help.

@tobiasschweizer
Copy link
Collaborator

@emargareten Would you have any resources to help figure out the algorithm for dealing with the months?

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

Successfully merging this pull request may close these issues.

None yet

3 participants