changeset 4121:9f03eb3817d6 v4-preview20190726-fixes

Use UTC for FWA diagrams. This prevents problems on Month (quarter/year) borders.
author Sascha Wilde <wilde@intevation.de>
date Thu, 01 Aug 2019 14:10:25 +0200
parents aececbc3d047
children 209bdd361615
files client/src/store/fairwayavailability.js
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js	Fri Jul 26 15:01:23 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Thu Aug 01 14:10:25 2019 +0200
@@ -18,9 +18,7 @@
 import {
   format,
   subYears,
-  startOfDay,
   startOfMonth,
-  endOfDay,
   endOfMonth,
   startOfYear,
   endOfYear,
@@ -240,13 +238,11 @@
         } else if (type == TYPES.SECTION || type == TYPES.STRETCH) {
           additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
         }
+        const start = encodeURIComponent("00:00:00+00:00");
+        const end = encodeURIComponent("23:59:59+00:00");
         const URL = `data/${endpoint}/fairway-depth/${encodeURIComponent(
           name
-        )}?from=${encodeURIComponent(
-          format(startOfDay(from), "YYYY-MM-DDTHH:mm:ssZ")
-        )}&to=${encodeURIComponent(
-          format(endOfDay(to), "YYYY-MM-DDTHH:mm:ssZ")
-        )}&mode=${frequency}&los=${LOS}${additionalParams}`;
+        )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`;
         HTTP.get(URL, {
           headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         })
@@ -282,6 +278,8 @@
           ? feature.properties.name
           : feature.get("objnam");
         [from, to] = getIntervallBorders(from, to, frequency);
+        const start = encodeURIComponent("00:00:00+00:00");
+        const end = encodeURIComponent("23:59:59+00:00");
         let additionalParams = "";
         let endpoint = type || TYPES.BOTTLENECK;
         if (type === TYPES.BOTTLENECK) {
@@ -294,11 +292,7 @@
         }
         const URL = `data/${endpoint}/availability/${encodeURIComponent(
           name
-        )}?from=${encodeURIComponent(
-          format(startOfDay(from), "YYYY-MM-DDTHH:mm:ssZ")
-        )}&to=${encodeURIComponent(
-          format(endOfDay(to), "YYYY-MM-DDTHH:mm:ssZ")
-        )}&mode=${frequency}&los=${LOS}${additionalParams}`;
+        )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`;
         HTTP.get(URL, {
           headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         })