# Change week starting numbers per month

Hello everyone!

I tested this sample.
docs.dhtmlx.com/gantt/samples/0 … 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?

Bye for now

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

Sorry, I’m too late…!

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…

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" } ];```