frappe / gantt

Open Source Javascript Gantt
https://frappe.io/gantt
MIT License
4.6k stars 1.02k forks source link

[Issue] Events displayed 12 hours later than they really are #369

Closed MartaWild closed 5 months ago

MartaWild commented 8 months ago

Hello! I was experimenting with the Gantt chart and noticed that there is an issue with displaying times of events. They appear 12 hours later than they really should be.

Here are some screenshots. You can see that I have one event that starts at midnight on October 1st and ends at noon on October 3rd. The date string is also parsed correctly to a Date object, but on the chart it displays as noon on October 1st and midnight on October 4th.

I think the problem is in the label position calculation: https://github.com/frappe/gantt/blob/1d024dcb55d3a150ca8c819985067f9a69ae80ba/src/index.js#L545

This happens only in the "quarter day" and "half day" modes.

var tasks = [
    {
        start: '2018-10-01 00:00:00',
        end: '2018-10-03 12:00:00',
        name: 'Redesign website',
        id: 'Task 0',
        progress: 20,
    },
];
var gantt_chart = new Gantt('.gantt-target', tasks, {
    on_click: (task) => {},
    on_date_change: (task, start, end) => {},
    on_progress_change: (task, progress) => {},
    on_view_change: (mode) => {},
    view_mode: 'Quarter Day',
    language: 'en',
});

image

safwansamsudeen commented 5 months ago

Thanks for your detailed explanation! Will be fixed by #382.