From 56770ec3c9bc05ea277f04ad2c6cfa1195c5b81d Mon Sep 17 00:00:00 2001 From: Tin Date: Thu, 17 Aug 2023 17:16:42 +0200 Subject: [PATCH] Update Timetable.vue --- resources/js/Timetable.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/js/Timetable.vue b/resources/js/Timetable.vue index 07c9025..5be4e0b 100755 --- a/resources/js/Timetable.vue +++ b/resources/js/Timetable.vue @@ -28,6 +28,7 @@ const props = defineProps({ }) const schedule = ref(props.initialSchedule) +const currentTime = ref(new Date()); Echo.channel('ScreenAll') .listen('.schedule.update', (e) => { @@ -38,6 +39,11 @@ const groupedSchedule = computed(() => { // Group by date return schedule.value .filter((entry) => { + const now = currentTime.value; + const start = new Date(entry.starts_at); + const end = new Date(new Date(entry.ends_at).getTime() + (entry.delay * 1000 * 60)); + + return (end.getDate() >= now.getDate() || start.getDate() >= now.getDate()) return true; }) .filter((entry) => {