From d2ed82cb37b6ea153b6968e6825a0d449da7cca2 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Thu, 10 Oct 2024 13:27:26 +0200 Subject: [PATCH] calculates the total amout of hours with an array filter instead of statically inserting all hours --- public/js/components/Calendar/Week/Page.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/public/js/components/Calendar/Week/Page.js b/public/js/components/Calendar/Week/Page.js index d56e9a330..725a72543 100755 --- a/public/js/components/Calendar/Week/Page.js +++ b/public/js/components/Calendar/Week/Page.js @@ -21,12 +21,11 @@ export default { 'page:forward', 'input' ], - data() { - return { - hours: [7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24] - }; - }, computed: { + hours(){ + // returns an array with elements starting at 7 and ending at 24 + return [...Array(24).keys()].filter(hour => hour >= 7 && hour <= 24); + }, days() { let tmpDate = new CalendarDate(this.year,1,1); // NOTE(chris): somewhere in the middle of the year