I make the schedule of classes. It is necessary that the calendar week numbers are displayed not from the beginning of the year, but from the beginning of September. The documentation says
You can also specify a week number.
I am writing a function() { var week = moment().week()-35; return week; } function() { var week = moment().week()-35; return week; } function() { var week = moment().week()-35; return week; } does not work, weeks are displayed from the beginning of the year, just moment().week()-35; same story.
Is there any working example function for the weekNumberCalculation? I use the FullCalendar extension for Yii, but the essence does not change.
UPD. figured out the function, the numbers of weeks have changed, but now they are all the same)
UPD2. Understood. The selected date is passed to the function. The code is:
'weekNumberCalculation'=>new CJavaScriptExpression("function getWeekNumber(d) { d = new Date(+d); // Начало семестра var yearStart = new Date(d.getFullYear(),8,1); var weekNo = Math.ceil(1+(( (d - yearStart) /86400000))/7); if (weekNo < 0) { return 0 } else {return weekNo}; }"),