コード例 #1
0
 ///<summary>Gets the length of a Hebrew month.</summary>
 ///<param name="month">The month.</param>
 ///<param name="hebrewYear">The year.</param>
 ///<returns>The number of days in the month.</returns>
 public static int Length(this HebrewMonth month, int hebrewYear)
 {
     if (month == 0)
     {
         throw new ArgumentOutOfRangeException("month", "None is not a valid month.");
     }
     return(calendar.GetDaysInMonth(hebrewYear, month.Index(hebrewYear)));
 }
コード例 #2
0
ファイル: HebrewDate.cs プロジェクト: zeroxist/Libraries
        ///<summary>Creates a Hebrew date.</summary>
        ///<param name="hebrewYear">The Hebrew year.</param>
        ///<param name="month">The Hebrew month.</param>
        ///<param name="day">The Hebrew day of the month.</param>
        public HebrewDate(int hebrewYear, HebrewMonth month, int day)
        {
            if (month == 0)
            {
                throw new ArgumentOutOfRangeException("month", "None is not a valid month.");
            }
            this.hebrewYear = hebrewYear;

            if (!calendar.IsLeapYear(hebrewYear) && month == HebrewMonth.אדר1)
            {
                month = HebrewMonth.אדר2;
            }

            hebrewMonth = month;
            hebrewDay   = day;
            date        = calendar.ToDateTime(hebrewYear, month.Index(hebrewYear), day, 0, 0, 0, 0);
        }