public void GregorianToJulianTest(long year, long month, long day, long expectedYear, long expectedMonth, long expectedDay) { AASCalendarDate gregorianDate = AASDate.GregorianToJulian(year, month, day); Assert.Equal(expectedYear, gregorianDate.Year); Assert.Equal(expectedMonth, gregorianDate.Month); Assert.Equal(expectedDay, gregorianDate.Day); }
public void MoslemToJulianTest(long year, long month, long day, long expectedYear, long expectedMonth, long expectedDay) { AASCalendarDate julianDate = AASMoslemCalendar.MoslemToJulian(year, month, day); Assert.Equal(expectedYear, julianDate.Year); Assert.Equal(expectedMonth, julianDate.Month); Assert.Equal(expectedDay, julianDate.Day); }
public void JulianToMoslemTest(long year, long month, long day, long expectedYear, long expectedMonth, long expectedDay) { AASCalendarDate moslemDate = AASMoslemCalendar.JulianToMoslem(year, month, day); Assert.Equal(expectedYear, moslemDate.Year); Assert.Equal(expectedMonth, moslemDate.Month); Assert.Equal(expectedDay, moslemDate.Day); }
public void DateOfPesachTest(long year, double expectedYear, double expectedMonth, double expectedDay) { AASCalendarDate jewishDate = AASJewishCalendar.DateOfPesach(year); Assert.Equal(expectedYear, jewishDate.Year); Assert.Equal(expectedMonth, jewishDate.Month); Assert.Equal(expectedDay, jewishDate.Day); }
public static AASCalendarDate DateOfPesach(long Year, bool bGregorianCalendar = true) { //What will be the return value AASCalendarDate Pesach = new AASCalendarDate(); long C = AASDate.INT(Year / 100.0); long S = AASDate.INT((3 * C - 5) / 4.0); if (bGregorianCalendar == false) { S = 0; } long A = Year + 3760; long a = (12 * Year + 12) % 19; long b = Year % 4; double Q = -1.904412361576 + 1.554241796621 * a + 0.25 * b - 0.003177794022 * Year + S; long INTQ = AASDate.INT(Q); long j = (INTQ + 3 * Year + 5 * b + 2 - S) % 7; double r = Q - INTQ; if ((j == 2) || (j == 4) || (j == 6)) { Pesach.Day = INTQ + 23; } else if ((j == 1) && (a > 6) && (r >= 0.632870370)) { Pesach.Day = INTQ + 24; } else if ((j == 0) && (a > 11) && (r >= 0.897723765)) { Pesach.Day = INTQ + 23; } else { Pesach.Day = INTQ + 22; } if (Pesach.Day > 31) { Pesach.Month = 4; Pesach.Day -= 31; } else { Pesach.Month = 3; } Pesach.Year = A; return(Pesach); }
public static long DaysInYear(long Year) { //Find the previous civil year corresponding to the specified jewish year long CivilYear = Year - 3761; //Find the date of the next Jewish Year in that civil year AASCalendarDate CurrentPesach = DateOfPesach(CivilYear); bool bGregorian = AASDate.AfterPapalReform(CivilYear, CurrentPesach.Month, CurrentPesach.Day); AASDate CurrentYear = new AASDate(CivilYear, CurrentPesach.Month, CurrentPesach.Day, bGregorian); AASCalendarDate NextPesach = DateOfPesach(CivilYear + 1); AASDate NextYear = new AASDate(CivilYear + 1, NextPesach.Month, NextPesach.Day, bGregorian); return((long)(NextYear.Julian - CurrentYear.Julian)); }
public static AASCalendarDate MoslemToJulian(long Year, long Month, long Day) { //What will be the return value AASCalendarDate julianDate = new AASCalendarDate(); long N = Day + AASDate.INT(29.5001 * (Month - 1) + 0.99); long Q = AASDate.INT(Year / 30.0); long R = Year % 30; long A = AASDate.INT((11 * R + 3) / 30.0); long W = 404 * Q + 354 * R + 208 + A; long Q1 = AASDate.INT(W / 1461.0); long Q2 = W % 1461; long G = 621 + 4 * AASDate.INT(7 * Q + Q1); long K = AASDate.INT(Q2 / 365.2422); long E = AASDate.INT(365.2422 * K); long J = Q2 - E + N - 1; long X = G + K; long XMod4 = X % 4; if ((J > 366) && (XMod4 == 0)) { J -= 366; X++; } if ((J > 365) && (XMod4 > 0)) { J -= 365; X++; } julianDate.Year = X; var julienDateDay = julianDate.Day; var julienDateMonth = julianDate.Month; AASDate.DayOfYearToDayAndMonth(J, AASDate.IsLeap(X, false), ref julienDateDay, ref julienDateMonth); julianDate.Day = julienDateDay; julianDate.Month = julienDateMonth; return(julianDate); }
public static AASCalendarDate JulianToMoslem(long Year, long Month, long Day) { //What will be the return value AASCalendarDate MoslemDate = new AASCalendarDate(); long W = Year % 4 != 0 ? 2 : 1; long N = AASDate.INT((275 * Month) / 9.0) - (W * AASDate.INT((Month + 9) / 12.0)) + Day - 30; long A = Year - 623; long B = AASDate.INT(A / 4.0); long C = A % 4; double C1 = 365.2501 * C; long C2 = AASDate.INT(C1); if ((C1 - C2) > 0.5) { C2++; } long Ddash = 1461 * B + 170 + C2; long Q = AASDate.INT(Ddash / 10631.0); long R = Ddash % 10631; long J = AASDate.INT(R / 354.0); long K = R % 354; long O = AASDate.INT((11 * J + 14) / 30.0); long H = 30 * Q + J + 1; long JJ = K - O + N - 1; if (JJ > 354) { long CL = H % 30; long DL = (11 * CL + 3) % 30; if (DL < 19) { JJ -= 354; H++; } else { JJ -= 355; H++; } if (JJ == 0) { JJ = 355; H--; } } long S = AASDate.INT((JJ - 1) / 29.5); MoslemDate.Month = 1 + S; MoslemDate.Day = AASDate.INT(JJ - 29.5 * S); MoslemDate.Year = H; if (JJ == 355) { MoslemDate.Month = 12; MoslemDate.Day = 30; } return(MoslemDate); }