Javascript JSon String Counting and Output

I manage the string and pass it to a class like this:

loadEvents() {
        $(".lbtbevent").remove();

        if (!this.eventsLoaded) {
            //this.events = JSON.parse(this.lbtbdata.getItem("events"));
            this.events = JSON.parse(this.lbtbdata);
            if (this.events) {
                for (const date of Object.keys(this.events)) {
                    for (const id of Object.keys(this.events[date])) {
                        const event = new Event(this.events[date][id]);
                        this.events[date][id] = event;
                    }
                }
            }
            this.eventsLoaded = true;
        }
        if (this.events) {
            for (let dayIndex = 0; dayIndex < 7; dayIndex++) {
                const date = dateString(addDays(this.weekStart, dayIndex));
                if (this.events[date]) {
                    for (const event of Object.values(this.events[date])) {
                        event.showIn(this);
                        //console.log(event);
                    }
                }
            }
        } else {
            this.events = {};
        }
    }

Then I output each individual value according to the hour and date. This results in a list of entries:

showIn(calendar) {
        if (
            this.date < dateString(calendar.weekStart) ||
            this.date > dateString(calendar.weekEnd)
        ) {
            $(`#${this.id}`).remove();
            return;
        }
        let eventSlot;
        if ($(`#${this.id}`).length) {
            eventSlot = $(`#${this.id}`);
        } else {
            eventSlot = $("<div></div>")
                .addClass("lbtbevent")
                .attr("id", this.id)
        }

        (function($) {
            $.renameTag = function($el, tagName) {
              $el.wrap('<' + tagName + '>');
              var $newElement = $el.parent();
              $.each($el.prop('attributes'), function() {
                  $newElement.attr(this.name,this.value);
              });
              $el.contents().unwrap();
              return $newElement;
          }
          })(jQuery);
          let test = Object.keys(this.id).length;

        let textoutput = this.sus + "-" + this.description;
        $.renameTag(eventSlot, 'a')
            .text(test)
            .prop('href', `schulzentrum_detail.php?id=${this.id}`) // Die URL zur Anzeige des Inhalts setzen.
            .css("backgroundColor", `var(--color-${this.color})`)
            .css("white-space", "nowrap")
            .css("position", "relative")
            .css("display", "block")
            .appendTo(`.slot[data-dayIndex=${this.dayIndex}].slot[data-hour=${this.startHour}]`);
    }

Now I don’t want every single value to be output per hour and per date, but rather the values ​​should be counted.

Previously the output was as follows:

Date: 19.08.2024 - 1 hour: OUTPUT1
Date: 19.08.2024 - 1 hour: OUTPUT2
Date: 19.08.2024 - 1 hour: OUTPUT3
Date: 19.08.2024 - 1 hour: OUTPUT4
Date: 19.08.2024 - 1 hour: OUTPUT5

Number of values. Above there were 5 values ​​that were output individually and now one value should be output with the number.
Now it should look like this:

Date: 19.08.2024 - 1 hour: TOTAL OUTPUT 5 PIECES

So far I have

Object.keys(jsonArray).length