Я реализую 5-летний представление в типе ресурса.[code]resource5YearsSlide: { type: 'resourceTimeline', buttonText: '5 Years', dateIncrement: { year: 1 }, slotDuration: { month: 3 }, slotLabelInterval: { month: 3 },
slotLabelFormat: function(arg) { const date = new Date(arg.date.marker); const month = date.getMonth(); const year = date.getFullYear(); const quarter = Math.floor(month / 3) + 1; return 'T' + quarter + ' ' + year; }, visibleRange: function (currentDate) { const start = new Date(currentDate); start.setMonth(0); start.setDate(1); const end = new Date(currentDate); end.setFullYear(start.getFullYear() + 4); end.setMonth(11); // Décembre end.setDate(31); return { start: start.toISOString(), end: end.toISOString() }; } }, < /code> Это отлично работает, но я бы нашел способ иметь 2 строки, первые на год, а второе место в течение кварталов.slotLabelFormat: [ { year: 'numeric', }, { custom:function(arg) { // Conversion explicite en objet Date natif const date = new Date(arg.date.marker); const month = date.getMonth(); const quarter = Math.floor(month / 3) + 1; return 'T' + quarter; } } ],
[/code] и другой ключ вместо «пользовательский», но функция вообще не называется, а в годичном строке хорошо распечатана.>