Getting date for week_unit_scale_text template


I’m using week_unit view and I’d like the column of every unit to show the number of events in that column. I’ve already used getEvents() to populate an array of counts for each date/resource combination. I can use that array to show the count in day view and in week view using the scale_text template. But in week_unit view, I can’t figure out how to determine the date of the current column.

This is the code I’m using:
scheduler.templates.week_unit_scale_text = function(key, label, unit) {
if (x.resource_count_unit[date_format(scheduler.getState().date)]) {
return label + ': ’ + “” + x.resource_count_unit[date_format(scheduler.getState().date)][key] + “”;

return true;

Of course, the is using the date for the beginning of the week, not for the column in question.

Thank you for your support.


To get the date of the target cell, you can use {view_name}_second_scale_date template that described in the article

Check the console in the snippet, there you can see how to get the required date in the week_unit_scale_text template.

That looks like it’s almost doing what I need. Strangely, the log looks OK, but if I return the date you generated as part of the template, it’s one day off.

All I changed in the snippet is to “return targetWeekUnitDate” in the scale_text:

Yes, it’s strange. To solve the issue, “return, 1, ‘day’)” from week_unit_scale_text template