Very slow when using timeline_cell_class to apply a class only if a certain scale is applied

We have multiple views using different scales. We have Month/Day, Month/Week, Year/Month, etc.

Only one set of views has a Day scale, and I want to apply a “weekend” class only if my config.scales includes a Day scale.

Is there a good way to apply this once instead of something like this?

gantt.templates.timeline_cell_class = function(_, date: Date) {
  const hasDayScale = (gantt.config as any).scales.some(
    (s: Scale) => s.unit === ScaleUnit.DAY

  if (hasDayScale && (date.getDay() == 0 || date.getDay() == 6)) {
    return 'my_task_cell--weekend';

  return '';

If you have several scales and switch between them, then you should have some value that indicates the current scale. You can use it in the timeline_cell_class template:

When I tried to apply your code, but it doesn’t work. Maybe, I don’t have some plugins that you use to obtain the value from the scales array.