changeset 4018:796b923269a6

waterlevels: include startOfDay and endOfDay as parameters)
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 22 Jul 2019 10:41:06 +0200
parents 639bdb17c3f2
children e9fc97a29bd6
files client/src/store/gauges.js
diffstat 1 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/gauges.js	Fri Jul 19 16:59:25 2019 +0200
+++ b/client/src/store/gauges.js	Mon Jul 22 10:41:06 2019 +0200
@@ -13,7 +13,7 @@
  */
 import { HTTP } from "@/lib/http";
 import { WFS } from "ol/format";
-import { isPast } from "date-fns";
+import { isPast, startOfDay, endOfDay, format } from "date-fns";
 
 let dateFrom = new Date();
 dateFrom.setDate(dateFrom.getDate() - 30);
@@ -136,16 +136,12 @@
       });
     },
     loadWaterlevels({ state, commit }) {
-      // include the last day
-      let dateTo = new Date(state.dateTo.getTime() + 86400);
-
       return new Promise((resolve, reject) => {
         HTTP.get(
-          `/data/waterlevels/${
-            state.selectedGaugeISRS
-          }?from=${state.dateFrom
-            .toISOString()
-            .substr(0, 23)}&to=${dateTo.toISOString().substr(0, 23)}`,
+          `/data/waterlevels/${state.selectedGaugeISRS}?from=${format(
+            startOfDay(state.dateFrom),
+            "YYYY-MM-DDTHH:mm:ss.SSS"
+          )}&to=${format(endOfDay(state.dateTo), "YYYY-MM-DDTHH:mm:ss.SSS")}`,
           {
             headers: { "X-Gemma-Auth": localStorage.getItem("token") }
           }