diff --git a/client/components/dates_popup/dates_popup.js b/client/components/dates_popup/dates_popup.js index ec6b902..edc8af9 100644 --- a/client/components/dates_popup/dates_popup.js +++ b/client/components/dates_popup/dates_popup.js @@ -12,6 +12,11 @@ class DatesPopup extends HTMLElement{ getDateTimeInput(){ let dateInputValue = this.getElementsByClassName("input-date")[0].valueAsDate; + let today = new Date(); + if(dateInputValue > today){ + dateInputValue = today; + alertify.warning("Date in the future : using today"); + } dateInputValue.setHours(0,0,0,0); let formattedHour = this.getElementsByClassName("input-time")[0].value; let timeMs = this.convertTimeStringToTimestamp(formattedHour); @@ -62,6 +67,7 @@ class DatesPopup extends HTMLElement{ this.hide(); this.getElementsByTagName("img")[0].onclick = () => {this.hide();}; this.getElementsByClassName("go-to-now-button")[0].onclick = () => {this.doGoToNowCallback();}; + this.getElementsByClassName("input-date")[0].max = new Date().toISOString().split("T")[0]; // sets the max to today (set only at app start) this.getElementsByClassName("jump-button-time")[0].onclick = () => {this.doJumpTimeCallback();}; this.getElementsByClassName("jump-button-all")[0].onclick = () => {this.doJumpAllCallback();}; } diff --git a/influxgraph.py b/influxgraph.py index 4f80080..63a742d 100644 --- a/influxgraph.py +++ b/influxgraph.py @@ -119,7 +119,7 @@ class InfluxGraph: result = self.influx_data_getter.get_curves_in_timerange(self.variables, self.time, interval) self.strip_future(result) - self.complete_to_end(result, end) + self.complete_to_end(result, min(end, now)) self.time[0] = self.time[1] # reduction not yet implemented return dict(type='graph-draw', reduced=False, graph=result)