This class extends ZmanimCalendar and provides many more zmanim than available in the ZmanimCalendar. The basis for most zmanim in this class are from the sefer Yisroel Vehazmanim by Rabbi Yisroel Dovid Harfenes.
For an example of the number of different zmanim made available by this class, there are methods to return 12 different calculations for alos (dawn) available in this class. The real power of this API is the ease in calculating zmanim that are not part of the API. The methods for doing zmanim calculations not present in this or it's superclass the ZmanimCalendar are contained in the AstronomicalCalendar, the base class of the calendars in our API since they are generic methods for calculating time based on degrees or time before or after sunrise" and sunset and are of interest for calculation beyond zmanim calculations. Here are some examples:
First create the Calendar for the location you would like to calculate: string locationName = "Lakewood, NJ" double latitude = 40.0828; //Lakewood, NJ double longitude = -74.2094; //Lakewood, NJ double elevation = 0; ITimeZone timeZone = new JavaTimeZone("America/New_York"); GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone); ComplexZmanimCalendar czc = new ComplexZmanimCalendar(DateTime.Now, location); Note: For locations such as Israel where the beginning and end of daylight savings time can fluctuate from year to year create a Zmanim.TimeZone.ITimeZone with the known start and end of DST.
To get alos calculated as 14° below the horizon (as calculated in the calendars published in Montreal) use: DateTime alos14 = czc.getSunriseOffsetByDegrees(14); To get mincha gedola calculated based on the MGA using a shaah zmanis based on the day starting 16.1° below the horizon (and ending 16.1° after sunset the following calculation can be used: DateTime minchaGedola = czc.getTimeOffset(czc.getAlos16point1Degrees(), czc.getShaahZmanis16Point1Degrees() * 6.5); A little more complex example would be calculating plag hamincha based on a shaah zmanis that was not present in this class. While a drop more complex it is still rather easy. For example if you wanted to calculate plag based on the day starting 12° before sunrise and ending 12° after sunset as calculated in the calendars in Manchester, England (there is nothing that would prevent your calculating the day using sunrise and sunset offsets that are not identical degrees, but this would lead to chatzos being a time other than the solar transit (solar midday)). The steps involved would be to first calculate the shaah zmanis and than use that time in milliseconds to calculate 10.75 hours after sunrise starting at 12° before sunset long shaahZmanis = czc.getTemporalHour(czc.getSunriseOffsetByDegrees(12), czc.getSunsetOffsetByDegrees(12)); DateTime plag = getTimeOffset(czc.getSunriseOffsetByDegrees(12), shaahZmanis * 10.75);

Disclaimer:

While I did my best to get accurate results please do not rely on these zmanim for halacha lemaaseh
Inheritance: Zmanim.ZmanimCalendar
        public void Will_return_null_when_trying_to_get_the_zman()
        {
            var calendar = new ComplexZmanimCalendar(
                new DateTime(2010, 5, 27),
                new GeoLocation("Gateshead, England", 54.9593729, -1.6018252, 0, new WindowsTimeZone(TimeZoneInfo.Utc))
                );

            Assert.That(calendar.GetAlos16Point1Degrees(), Is.Null);
        }
Beispiel #2
0
        public IEnumerable<ComplexZmanimCalendar> GetDaysInHebrewMonth(DateTime yearAndMonth, GeoLocation location)
        {
            Calendar calendar = new HebrewCalendar();
            var daysInMonth = calendar.GetDaysInMonth(calendar.GetYear(yearAndMonth), calendar.GetMonth(yearAndMonth));

            for (int i = 0; i < daysInMonth; i++)
            {
                var zmanimCalendar = new ComplexZmanimCalendar(location);
                zmanimCalendar.DateWithLocation.Date = new DateTime(yearAndMonth.Year, yearAndMonth.Month, i + 1);
                yield return zmanimCalendar;
            }
        }
Beispiel #3
0
        public void Check_is_offset_timezone_working()
        {
            String locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            var timeZone = new OffsetTimeZone(new TimeSpan(0, 0, -14400));
            var location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            var czc = new ComplexZmanimCalendar(new DateTime(2010, 4, 2), location);

            var zman = czc.GetSunrise();

            Assert.That(zman, Is.EqualTo(
                    new DateTime(2010, 4, 2, 6, 39, 41, 832)
                ));
        }
Beispiel #4
0
        public IEnumerable<ComplexZmanimCalendar> GetDaysInHebrewYear(DateTime year, GeoLocation location)
        {
            Calendar calendar = new HebrewCalendar();
            var currentYear = calendar.GetYear(year);
            var amountOfMonths = calendar.GetMonthsInYear(currentYear);

            for (int i = 0; i < amountOfMonths; i++)
            {
                var currentMonth = i + 1;
                var daysInMonth = calendar.GetDaysInMonth(currentYear, currentMonth);

                for (int dayOfMonth = 0; dayOfMonth < daysInMonth; dayOfMonth++)
                {
                    var zmanimCalendar = new ComplexZmanimCalendar(location);
                    zmanimCalendar.DateWithLocation.Date = new DateTime(currentYear, currentMonth, dayOfMonth + 1, calendar);
                    yield return zmanimCalendar;
                }
            }
        }
        public ComplexZmanimCalendar GetCalendar()
        {
            String locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            ITimeZone timeZone = new OlsonTimeZone("America/New_York");
            GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            ComplexZmanimCalendar czc = new ComplexZmanimCalendar(new DateTime(2010, 4, 2), location);

            /*
            string locationName = "Brooklyn, NY";
            double latitude = 40.618851; //Brooklyn, NY
            double longitude = -73.985921; //Brooklyn, NY
            double elevation = 0; //optional elevation
            TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
            var location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            var czc = new ComplexZmanimCalendar(location);
            czc.setCalendar(new GregorianCalendar(2010, 3, 2));
            */
            return czc;
        }
Beispiel #6
0
        public void Setup()
        {
            String locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            ITimeZone timeZone = new OlsonTimeZone("America/New_York");
            GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            ComplexZmanimCalendar czc = new ComplexZmanimCalendar(new DateTime(2010, 4, 2), location);

            calendar = czc;
        }