stefanuebe/vaadin-fullcalendar

Setting a custom function for weekNumberCalculation

Closed this issue · 8 comments

Is it possible to set a function for this property?
https://fullcalendar.io/docs/v4/weekNumbers)

Yes, it is FullCalendar#setWeekNumbersVisible(boolean)

Also please note, that this addon utilizes Full Calendar v5, not 4.

Hi Stefan,
I mean the weekNumberCalculation property, to set a custom function for providing week numbers
https://fullcalendar.io/docs/weekNumberCalculation

Thank you for your great addon

Dear @stefanuebe.
I am trying to create a dynamic text for each calendar week by passing a custom function to the weekNumberContent property, as follows:

	initialOptions.put("weekNumbers", true);
	initialOptions.put("weekNumberContent",
			"function(arg) { " + 
			"   console.log('This is not executed');" +
			"   arg.text='hello';" + 
			"}");

However, the function above is never executed and it is rendered as text in every calendar week. Any suggestion?
Thanks!

Hi,
Many thanks you for your help.
The code is as follows

calendar.getElement().executeJs(
"""
this.setOption('weekNumberCalculation', function(date) {
return 0;
});
"""
);