Exemple #1
0
        private IHtmlNode BuildMonthView(ICalendarHtmlBuilder renderer)
        {
            NormalizeSelectDates();

            IHtmlNode monthTag = renderer.MonthTag();

            DateTime focusedDate = this.DetermineFocusedDate();
            DateTime prevMonth   = GetLastDayOfMonth(focusedDate).AddMonths(-1);
            DateTime startDate   = GetStartOfWeek(prevMonth, CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek);

            for (int weekRow = 0; weekRow < 6; weekRow++)
            {
                IHtmlNode rowTag = renderer.RowTag();

                for (int day = 0; day < 7; day++)
                {
                    renderer.CellTag(startDate, Value, urlFormat, startDate.Month != focusedDate.Month).AppendTo(rowTag);
                    startDate = startDate.AddDays(1);
                }
                monthTag.Children.Add(rowTag);
            }
            return(monthTag);
        }
        private IHtmlNode BuildMonthView(ICalendarHtmlBuilder renderer)
        {
            IHtmlNode monthTag = renderer.MonthTag();

            DateTime? focusedDate = this.DetermineFocusedDate();
            DateTime prevMonth = new DateTime(focusedDate.Value.Year, focusedDate.Value.Month, 1).AddDays(-1);

            int firstDayOfMonthView = DateTime.DaysInMonth(prevMonth.Year, prevMonth.Month) - ((int)(prevMonth).DayOfWeek);

            DateTime startDate = new DateTime(prevMonth.Year, prevMonth.Month, firstDayOfMonthView);
            for (int weekRow = 0; weekRow < 6; weekRow++)
            {
                IHtmlNode rowTag = renderer.RowTag();

                for (int day = 0; day < 7; day++)
                {
                    renderer.CellTag(startDate, urlFormat, startDate.Month != focusedDate.Value.Month).AppendTo(rowTag);
                    startDate = startDate.AddDays(1);
                }
                monthTag.Children.Add(rowTag);
            }
            return monthTag;
        }
Exemple #3
0
        private IHtmlNode BuildMonthView(ICalendarHtmlBuilder renderer)
        {
            NormalizeSelectDates();

            IHtmlNode monthTag = renderer.MonthTag();

            DateTime focusedDate = this.DetermineFocusedDate();
            DateTime prevMonth = GetLastDayOfMonth(focusedDate).AddMonths(-1);
            DateTime startDate = GetStartOfWeek(prevMonth, CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek);

            for (int weekRow = 0; weekRow < 6; weekRow++)
            {
                IHtmlNode rowTag = renderer.RowTag();

                for (int day = 0; day < 7; day++)
                {
                    renderer.CellTag(startDate, Value, urlFormat, startDate.Month != focusedDate.Month).AppendTo(rowTag);
                    startDate = startDate.AddDays(1);
                }
                monthTag.Children.Add(rowTag);
            }
            return monthTag;
        }
        public void MonthTag_should_render_tbody_tag()
        {
            IHtmlNode tag = renderer.MonthTag();

            Assert.Equal("tbody", tag.TagName);
        }