Пример #1
0
        /// <summary>
        /// Creates A MonthAYear Group Using A Forward-Slash Date Formatted String. Example: 01/01/2021.
        /// Could Also Try Using Standard Date Format. Example: January 1st, 2021.
        /// </summary>
        /// <param name="_date"></param>
        /// <returns></returns>
        public MyMonthAYearGroupUtility(string _date)
        {
            var _dateByMonthAndYear = CalculateDateByMonthAndYear(_date);

            this.DateByMonth = _dateByMonthAndYear.dateByMonth;
            this.DateByYear  = _dateByMonthAndYear.dateByYear;
            this.DateByDay   = _dateByMonthAndYear.dateByDay;
        }
Пример #2
0
        public static int GetDayCountFromMonthAYear(EDateByMonth _month, EDateByYear _year)
        {
            switch (_month)
            {
            case EDateByMonth.Undecided:
                return(-1);

            case EDateByMonth.January:
                return(31);

            case EDateByMonth.February:
                if (_year == EDateByYear.Y2020 || _year == EDateByYear.Y2024)
                {
                    return(29);
                }
                return(28);

            case EDateByMonth.March:
                return(31);

            case EDateByMonth.April:
                return(30);

            case EDateByMonth.May:
                return(31);

            case EDateByMonth.June:
                return(30);

            case EDateByMonth.July:
                return(31);

            case EDateByMonth.August:
                return(31);

            case EDateByMonth.September:
                return(30);

            case EDateByMonth.October:
                return(31);

            case EDateByMonth.November:
                return(30);

            case EDateByMonth.December:
                return(31);

            default:
                return(-1);
            }
        }
Пример #3
0
 public static bool IsMonthMissingDays(EDateByMonth _month, EDateByYear _year, int _dayCount)
 {
     return(_dayCount != GetDayCountFromMonthAYear(_month, _year));
 }
Пример #4
0
 private MyMonthAYearGroupUtility()
 {
     this.DateByMonth = EDateByMonth.Undecided;
     this.DateByYear  = EDateByYear.Undecided;
 }