Change week starting numbers per month

Hello everyone!

I tested this sample. … cales.html

In ‘ Year View ’, I added the scale of week.
However, this numbering is from “1” to “52”.

I hope that starts with “1”, every month.
(ex. 1,2,3,4 / 1,2,3,4)

How can I solve this problem?
Please help me :smiley:

Bye for now

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

Sorry, I’m too late…!

First, Thank you for your answers.
I worked like your answers.

But there is a problem.

The boundaries of the month become ambiguous, and I want to clarify this boundary.
Like this.

Do you know how to do it?
Thank you very much indeed… :heart:

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: = function(date){ ... return startOfInterval; // i.e. like (;//return 1st day of the month }; = 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" } ];

For example -
or with the day scale -
However, it’s a very quick sample, I’m not sure if this implementation will work as expected in all use cases.


I really appreciate you.
Eventually, I solved my work by your favors.

Thank you so much!!! :smiley: