Hi,
this seems to be common agreement, cause the year can start from the middle of week, or the month can start from the end of the week.
Anyway, at your case you can probably use “getDate” method to calculate month’s week, for example something like this
var week = Math.floor((date.getDate() - 1) / 7);
return week;
This will return you at first the date of the month, and then you can calculate current week usin Math.floor method
Hi,
such time scale is not supported by default, but you can probably implement a custom time unit (weeks aligned by month) and use it as a unit of a time scale.
Implementing a time unit means impementing two functions:
gantt.date.customUnit_start = function(date){
...
return startOfInterval; // i.e. like (gantt.date.month_start(someDate);//return 1st day of the month
};
gantt.date.add_customUnit = function(date, inc){
// increment/decrement for custom units
}
‘customUnit’ is the name of the time unit you’ll use in code.gantt.config.subscales = [
{unit:"customUnit", step:1, template:customLabelFunction},
{unit:"month", step:1, date:"%M" }
];