Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entry expands over 2 days on summertime changeover #6419

Open
chuckn0rris opened this issue Mar 21, 2023 · 1 comment
Open

Entry expands over 2 days on summertime changeover #6419

chuckn0rris opened this issue Mar 21, 2023 · 1 comment
Assignees
Labels
bug Something isn't working forum Issues from forum OEM OEM customer

Comments

@chuckn0rris
Copy link

Forum post

Copy/paste this code to one of examples.
Change timezone to Germany/Berlin.
Goto March 26, see that 1 day event looks like 2 days event.

import { SchedulerPro, EventHelper, PresetManager, StringHelper, EventModel } from '../../build/schedulerpro.module.js?466403';
import shared from '../_shared/shared.module.js?466403';

const
    zoomLevels = {
        minuteAndHour : 1,
        hourAndDay    : 1
    };

class ProEvent extends EventModel {
    static fields = [
        { name : 'durationUnit', defaultValue : 'hour' }
    ];
}

const scheduler = new SchedulerPro({
    // Limit zoom levels to those which use hours to make filtering non-working time works better in this demo
    
// A Project holds the data and the calculation engine for Scheduler Pro. It also acts as a CrudManager, allowing
// loading data into all stores at once


appendTo          : 'container',
startDate         : '2023-03-23',
endDate           : '2023-03-28',
rowHeight         : 90,
barMargin         : 15,
eventStyle        : 'border',
resourceImagePath : '../_shared/images/users/',

// Custom viewPreset (based on 'hourAndDay') that displays a compact 24-hour bottom header
viewPreset : {
    base              : 'hourAndDay',
    tickWidth         : 30,
    displayDateFormat : 'll HH:mm',
    headers           : [
        {
            unit       : 'day',
            dateFormat : 'ddd DD/MM' //Mon 01/10
        },
        {
            unit       : 'hour',
            dateFormat : 'HH'
        }
    ]
},

features : {
    // Not using the dependencies feature
    dependencies : false
},

columns : [
    // Column that displays a thumb for the resource
    {
        type : 'resourceInfo',
        text : 'Manager'
    }
],

// Custom event renderer that displays small thumbs for assigned resources
eventRenderer({ eventRecord, renderData }) {
    const durationColors = {
        0 : 'blue',
        1 : 'indigo',
        2 : 'violet'
    };

    // Project length determines color
    renderData.eventColor = durationColors[Math.min(Math.floor(eventRecord.duration / 9), 2)];

    // Custom content, displays images for assigned resources + event name
    return [
        {
            html : StringHelper.encodeHtml(eventRecord.name)
        },
        {
            className : 'assigned',
            children  : eventRecord.resources.map(resource => ({
                tag       : 'img',
                draggable : false,
                src       : resource.image !== false ? this.resourceImagePath + resource.name.toLowerCase() + '.jpg' : null,
                dataset   : {
                    resourceId : resource.id
                }
            }))
        }
    ];
},

listeners : {
    paint({ firstPaint }) {
        if (firstPaint) {
            // To have resource images in events redrawn when assignments change, do a full refresh
            this.assignmentStore.on({
                add     : 'refreshWithTransition',
                remove  : 'refreshWithTransition',
                thisObj : this
            });

            // Select row when clicking a resource image on an event
            EventHelper.on({
                element  : this.element,
                delegate : '.assigned img',
                thisObj  : this,
                click(event) {
                    this.selectRow({ record : event.target.dataset.resourceId });
                }
            });
        }
    }
},

tbar : [
    // Add a button to filter out non-working time
    {
        ref         : 'filterButton',
        type        : 'button',
        text        : 'Filter out non-working time',
        toggleable  : true,
        icon        : 'b-fa-square',
        pressedIcon : 'b-fa-check-square',
        onToggle({ pressed }) {
            if (pressed) {
                // Filter that keeps working time ticks in time axis
                scheduler.timeAxis.filter(t => scheduler.project.calendar.isWorkingTime(t.startDate, t.endDate));
            }
            else {
                // Restore all ticks
                scheduler.timeAxis.clearFilters();
            }
        }
    }
]
});

scheduler.resources = [{
    id: 1,
    name : 'Name'
}]; 
scheduler.events = [{
allDay: true,
draggable: false,
duration: 1,
durationUnit: "d",
eventColor: "#C4E538",
id: 11050,
name: "FS1",
note: "TEST",
resizable: false,
resourceId: 1,
startDate: "2023-03-26",
supportsRecurring: false

}]

@chuckn0rris chuckn0rris added bug Something isn't working forum Issues from forum OEM OEM customer labels Mar 21, 2023
@canonic-epicure canonic-epicure self-assigned this Jun 29, 2023
@PatrickHuetter
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum OEM OEM customer
Projects
None yet
Development

No branches or pull requests

3 participants