Esempio n. 1
0
        internal static string Year(int year, bool disabled, DatePickerComponentBase state)
        {
            var(start, end) = state.MonthToDisplay.GetDecade();
            var strClass = "year";

            if (disabled)
            {
                strClass += " disabled";
            }

            if (state.SelectedYear.HasValue && year == state.SelectedYear.Value)
            {
                strClass += " active";
            }

            if (year < start)
            {
                strClass += " old";
            }
            else if (year > end)
            {
                strClass += " new";
            }

            return(strClass);
        }
Esempio n. 2
0
        internal static string Decade(int decade, bool disabled, DatePickerComponentBase state)
        {
            var(start, end) = state.MonthToDisplay.GetCentury();
            var strClass = "decade";

            if (state.SelectedDecade.HasValue && decade == state.SelectedDecade.Value)
            {
                strClass += " active";
            }

            if (disabled)
            {
                strClass += " disabled";
            }

            if (decade < start)
            {
                strClass += " old";
            }
            else if (decade > end)
            {
                strClass += " new";
            }

            return(strClass);
        }
Esempio n. 3
0
        internal static string Month(int month, bool disabled, DatePickerComponentBase state)
        {
            var strClass = "month";

            // Disabled
            if (disabled)
            {
                strClass += " disabled";
            }

            // Active
            if ((state.SelectedMonth.HasValue && month == state.SelectedMonth.Value) &&
                (state.SelectedYear == state.MonthToDisplay.Year))
            {
                strClass += " active";
            }

            return(strClass);
        }
Esempio n. 4
0
        /// <summary>The value of the class attribute for the Day element.</summary>
        /// <param name="Date">The day to render.</param>
        /// <param name="State"></param>
        /// <returns></returns>
        internal static string Day(LocalDate Date, DatePickerComponentBase State)
        {
            bool disabled = State.IsDayDisabled(Date);
            bool isToday  = Date == State.Today;
            bool isOld    = Date.Month < State.MonthToDisplay.Month;
            bool isNew    = Date.Month > State.MonthToDisplay.Month;

            var sb = new List <string>
            {
                "day",
                Date.DayOfWeek.IsWeekday() ? "weekday" : "weekend"
            };

            if (isOld)
            {
                sb.Add("old");
            }
            if (isNew)
            {
                sb.Add("new");
            }
            if (isToday)
            {
                sb.Add("today");
            }
            if (State.SelectedDate == Date)
            {
                sb.Add("active");
            }
            if (disabled)
            {
                sb.Add("disabled");
            }

            return(string.Join(" ", sb));
        }