Unplanned
Last Updated: 27 Mar 2018 14:50 by ADMIN
ADMIN
Peter Milchev
Created on: 09 Mar 2018 12:35
Category: Scheduler
Type: Bug Report
1
Daylight saving day duplicated in MonthView with WebService binding
https://www.screencast.com/t/KlQtYDOxl

Workaround: 

var $ = $ || $telerik.$;
var $T = Telerik.Web.UI;
var $TS = $T.Scheduler,
$TSR = $TS.Rendering,
$DateTime = $TS.DateTime;
var $SB = Telerik.Web.StringBuilder,
timePerMinute = 60000,
timePerHour = timePerMinute * 60,
timePerDay = timePerHour * 24,
daysInWeek = 7,
roundedCornersHeight,
anchorDateFormat = "yyyy-MM-dd";

$TSVM = Telerik.Web.UI.Scheduler.Views.Month;
$TSVM.Model.prototype._createTimeSlot = function (rawIndex, startTime, element) {
    if (startTime.getHours() == 23) {
        startTime = $DateTime.add(startTime, 2 * timePerHour);
    }

    return new $TSVM.TimeSlot(rawIndex, startTime, element);
}

$TSVM.Model.prototype.getTimeSlotFromDomElement = function (domElement) {
    var rawIndex = this._getRawIndexFromDomElement(domElement),
                startTime = this._getTimeFromDomElement(domElement);
    if (startTime.getHours() == 23) {
        startTime = $DateTime.add(startTime, 2 * timePerHour);
    }

    return new $TSVM.TimeSlot(rawIndex, startTime, domElement);
}


Telerik.Web.UI.Scheduler.Rendering.MonthViewRenderer.prototype._updateColumnHeaders = function () {
    var renderer = this,
        dayHeaderDateFormat = this._model.get_dayHeaderDateFormat(),
        firstDayHeaderDateFormat = this._model.get_firstDayHeaderDateFormat(),
        currentMonth = renderer._owner.get_selectedDate().getMonth(),
        visibleRangeStart = renderer._model.get_visibleRangeStart();

    $.each(this._contentTables, function () {
        var dateLabels = $("td div.rsDateWrap div.rsDateBox a", this),
            dayStart = visibleRangeStart,
            weekDayIndex = 0,
            weekStart = new Date(dayStart.getTime());

        dateLabels.each(function () {
            var isFirstVisibleDateOfMonth =
                    $DateTime.subtract(dayStart, visibleRangeStart) == 0 &&
                    dayStart.getMonth() == currentMonth;
            var dateHeaderText;

            if (renderer._owner._renderMode == $T.RenderMode.Mobile) {
                dateHeaderText = dayStart.getDate().toString();
            }
            else if (dayStart.getDate() == 1 || isFirstVisibleDateOfMonth) {
                dateHeaderText = dayStart.localeFormat(firstDayHeaderDateFormat);
            } else {
                dateHeaderText = renderer._getFormattedDateText(dayStart, dayHeaderDateFormat);
            }

            this.href = "#" + dayStart.format(anchorDateFormat);
            this.innerHTML = dateHeaderText;
            this.title = dayStart.localeFormat(Sys.CultureInfo.CurrentCulture.dateTimeFormat.ShortDatePattern);

            var otherMonthCell = currentMonth != dayStart.getMonth(),
                dateWrapElement = this.parentNode.parentNode.parentNode;

            $(dateWrapElement).toggleClass('rsOtherMonth', otherMonthCell);

            if (weekDayIndex == renderer._weekLength - 1) {
                // Move to the next week, skipping invisible days.
                weekStart = $DateTime.add(weekStart, 7 * timePerDay);
                dayStart = new Date(weekStart.getTime());
                weekDayIndex = 0;
            } else {
                dayStart = $DateTime.add(dayStart, timePerDay);
                weekDayIndex++;
            }
            if (dayStart.getHours() == 23) {
                dayStart = $DateTime.add(dayStart, 2 * timePerHour);
            } else if (dayStart.getHours() == 1) {
                dayStart = $DateTime.add(dayStart, -timePerHour);
            }
            if (weekStart.getHours() == 23) {
                weekStart = $DateTime.add(weekStart, 2 * timePerHour);
            } else if (weekStart.getHours() == 1) {
                weekStart = $DateTime.add(dayStart, -timePerHour);
            }
            // Wrappers are cleared here to avoid second
            // traversal of the cells.
            renderer._clearExtraWraps(dateWrapElement);
        });
    });
}
0 comments