From 29067f48078bc4bcf5fe9fd575b00c9da24f4b77 Mon Sep 17 00:00:00 2001 From: soraefir Date: Wed, 19 Jul 2023 09:55:43 +0200 Subject: [PATCH] Added fallback if missing dates --- public/js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index dc3a257..7417d49 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -200,14 +200,18 @@ const app = new Vue({ total_days: function(){ if(this.journey_data.main.length==0) return 0; - return (this.journey_data.main[this.journey_data.main.length-1].dateRange[0]-this.journey_data.main[0].dateRange[0])/(1000*60*60*24) + try{ + return (this.journey_data.main[this.journey_data.main.length-1].dateRange[0]-this.journey_data.main[0].dateRange[0])/(1000*60*60*24) + }catch{ + return '?' + } }, total_date: function(){ if(this.journey_data.main.length==0) return ''; try{ return `${this.format_date(this.journey_data.main[0].dateRange[0])} - ${this.format_date(this.journey_data.main[this.journey_data.main.length-1].dateRange[0])}`; }catch{ - return ''; + return '?'; } }, update_date: function(idx){