Mercurial > gemma
changeset 4086:23f88a6c1e88 timezone
importoverview, fairwayavailability, gauges: handle timezones
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 25 Jul 2019 17:11:30 +0200 |
parents | 350a24c92848 |
children | 472aedc8927d |
files | client/src/components/importoverview/ImportOverview.vue client/src/store/fairwayavailability.js client/src/store/gauges.js |
diffstat | 3 files changed, 23 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue Thu Jul 25 16:58:27 2019 +0200 +++ b/client/src/components/importoverview/ImportOverview.vue Thu Jul 25 17:11:30 2019 +0200 @@ -343,8 +343,10 @@ this.$store .dispatch("imports/getImports", { filter: this.filters, - from: format(this.startDate, "YYYY-MM-DDTHH:mm:ss.SSS"), - to: format(this.endDate, "YYYY-MM-DDTHH:mm:ss.SSS"), + from: encodeURIComponent( + format(this.startDate, "YYYY-MM-DDTHH:mm:ssZ") + ), + to: encodeURIComponent(format(this.endDate, "YYYY-MM-DDTHH:mm:ssZ")), query: this.searchQuery }) .then(() => {
--- a/client/src/store/fairwayavailability.js Thu Jul 25 16:58:27 2019 +0200 +++ b/client/src/store/fairwayavailability.js Thu Jul 25 17:11:30 2019 +0200 @@ -18,7 +18,9 @@ import { format, subYears, + startOfDay, startOfMonth, + endOfDay, endOfMonth, startOfYear, endOfYear, @@ -238,11 +240,13 @@ } 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=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`; + )}?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}`; HTTP.get(URL, { headers: { "X-Gemma-Auth": localStorage.getItem("token") } }) @@ -278,8 +282,6 @@ ? 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) { @@ -292,7 +294,11 @@ } const URL = `data/${endpoint}/availability/${encodeURIComponent( name - )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`; + )}?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}`; HTTP.get(URL, { headers: { "X-Gemma-Auth": localStorage.getItem("token") } })
--- a/client/src/store/gauges.js Thu Jul 25 16:58:27 2019 +0200 +++ b/client/src/store/gauges.js Thu Jul 25 17:11:30 2019 +0200 @@ -138,10 +138,13 @@ loadWaterlevels({ state, commit }) { return new Promise((resolve, reject) => { HTTP.get( - `/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")}`, + `/data/waterlevels/${ + state.selectedGaugeISRS + }?from=${encodeURIComponent( + format(startOfDay(state.dateFrom), "YYYY-MM-DDTHH:mm:ssZ") + )}&to=${encodeURIComponent( + format(endOfDay(state.dateTo), "YYYY-MM-DDTHH:mm:ssZ") + )}`, { headers: { "X-Gemma-Auth": localStorage.getItem("token") } }