Esempio n. 1
0
        /// <summary>
        /// Gets the approximate total days count for the specified <paramref name="calendar"/>.
        /// Uses <see cref="DateTime.Today"/>'s year for the calculate.
        /// </summary>
        /// <param name="calendar">The calendar object.</param>
        /// <returns>
        /// Total days that this <see cref="DateTimeInterval"/> represents for the given <paramref name="calendar"/>.
        /// </returns>
        public int GetApproximateTotalDays(System.Globalization.Calendar calendar)
        {
            int approximate = this.days;

            if (this.months > 0)
            {
                int monthsInYear = calendar.GetMonthsInYear(DateTime.Today.Year);
                int daysInYear   = calendar.GetDaysInYear(DateTime.Today.Year);
                approximate += daysInYear / monthsInYear;
            }

            return(approximate);
        }