setting start date and time on horizontal scheduler

Discuss issues related to v4.x
Post Reply
User avatar
cyprien
Posts: 1
Joined: Tue Jan 22, 2019 1:17 pm

setting start date and time on horizontal scheduler

Post by cyprien » Wed Feb 27, 2019 1:18 pm

We are developping an app in Extjs with a scheduler. The scheduler is designed like this :

Code: Select all

processTimelineViewScheduler: function(config) {
    var me = this;
    var startDate = new Date();
    var endDate = new Date();

    var cinema =        MiscFunctions.getCinema();
    var scheduleStart = cinema.schedulestart; // 06:00
    var scheduleEnd =   cinema.scheduleend; // 05:59

    var partstart =    scheduleStart.split(":");
    var startHours =   partstart[0];
    var startMinutes = partstart[1];

    var partend =    scheduleEnd.split(":");
    var endHours =   partend[0];
    var endMinutes = partend[1];

    startDate.setHours(startHours);
    startDate.setMinutes(startMinutes);
    startDate.setSeconds(0);

    endDate.setHours(endHours);
    endDate.setMinutes(endMinutes);
    endDate.setSeconds(0);

    if (endDate.getTime() <= startDate.getTime()) {
        endDate = Ext.Date.add(endDate, Ext.Date.DAY, 1);
    }

       Sch.preset.Manager.registerPreset("myHourAndDay", {
        displayDateFormat : 'G:i',
        shiftIncrement    : 1,
        shiftUnit         : 'HOUR',
        timeRowHeight     : 75,
        timeResolution    : {
            // Here we use Sch.util.Date.MINUTE constant value
            unit      : Sch.util.Date.MINUTE,
            increment : 5
        },
        headerConfig : {
            middle : {
                // and here we use the last fraction Sch.util.Date.HOUR constant name
                unit       : 'HOUR',
                dateFormat : 'G:i'
            }
        }
    });
    return Ext.apply(config, {
        columns    : [{
            sortable: true,
            width: 100,
            dataIndex: 'Name',
            flex: 1
        }],
        split: false,
        readOnly:                !MiscFunctions.hasRight('SHOW_WRITE'),
        enableDragCreation:      false,
        viewPreset:              {
            name: 'myHourAndDay',
            timeColumnWidth: 100,
        },
        highlightWeekends:       false,
        mode:                    'horizontal',
        startDate:               startDate,
        endDate:                 endDate,
        weekStartDay:            3,
        showTodayLine:           true,
        rowHeight:               65,
        constrainDragToResource: false,
        snapToIncrement:         true,
        eventResizeHandles:      'none',
        eventBarTextField:       'Title',
        crudManager:             this.getCrudManager(),

    });
}
variables scheduleStart and scheduleEnd can be 10:00 and 09:59 (on next day).

The scheduler arbitrarly sets the start time and end time in the view (eg: 21:00 to 21:00).

If the variables scheduleStart and scheduleEnd are 06:00 and 05:59 on next day, the start and end dates and times are correct in the view.

User avatar
mats
Core Developer
Core Developer
Posts: 13381
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: setting start date and time on horizontal scheduler

Post by mats » Wed Feb 27, 2019 1:26 pm

Can you reproduce this in our demos? Please try to reproduce it then upload a zip file with the minimal test case so we can inspect.
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

Post Reply