#101403
Anonymous
Inactive

Hi,
I have a question for the timeline header visualization with week view. I want to use this type of view with durationUnit hour, in the first level of the header I would like to show the month and the year (ex: January 2021), in the second level (the cell) the day and the weekday (ex: Fri 29 ). But the cell and the month+year not corresponding correctly because the week visualization (correctly) not consider the beginning and the end of the month not with the days but with the week (the week end with Saturday and thus the month not finish with his last day); there is a correct configuration for my target?
This is my current code for this type of configuration:
var gantt = document.querySelector(‘smart-gantt-chart’);
gantt.hideTimelineHeaderDetails = false;
gantt.timelineHeaderFormatFunction = function(date, type, isHeaderDetails,
value) {
const ganttChart = document.querySelector(‘smart-gantt-chart’);
if (type === ‘week’) {
return date.toLocaleDateString(ganttChart.locale, {
month : ‘long’,
year : ‘numeric’,
});
}
if (type === ‘day’) {
return date.toLocaleDateString(ganttChart.locale, {
day : ‘numeric’,
weekday : ‘short’
});
}
return value;
};
gantt.locale = ‘it’;
gantt.showProgressLabel = false;
gantt.durationUnit = ‘hour’;
gantt.view = ‘week’;
gantt.treeSize = ‘40%’;
gantt.nonworkingHours = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 18, 19, 20, 21,
22, 23 ];
gantt.nonworkingDays = [ 0, 6 ];
gantt.taskColumns = [ {
label : ‘TASK NAME’,
value : ‘label’,
size : ‘70%’
}, {
label : ‘END DATE’,
value : ‘dateEnd’,
size : ‘20%’,
}, {
label : ‘DURATION’,
value : ‘duration’,
size : ‘10%’,
} ];
gantt.dataSource = data;
Thanks in advance for your help.
Walter