changeset 2337:0f3b0937e7c1

staging: format datetime instead of format date in AGM Diff View
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 19 Feb 2019 17:06:55 +0100
parents dbf28b27b74e
children 918091d1df72
files client/src/components/staging/StagingDetail.vue client/src/lib/date.js
diffstat 2 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/staging/StagingDetail.vue	Tue Feb 19 17:00:32 2019 +0100
+++ b/client/src/components/staging/StagingDetail.vue	Tue Feb 19 17:06:55 2019 +0100
@@ -198,9 +198,7 @@
               ><small>{{ result["fk-gauge-id"] }}</small></span
             >
             <span class="condensed agmdetail text-left"
-              ><small>{{
-                formatSurveyDate(result["measure-date"])
-              }}</small></span
+              ><small>{{ formatDateTime(result["measure-date"]) }}</small></span
             >
             <div
               @click="toggleDiff(index)"
@@ -292,7 +290,7 @@
  * Thomas Junk <thomas.junk@intevation.de>
  */
 
-import { formatSurveyDate } from "@/lib/date.js";
+import { formatSurveyDate, formatDateTime } from "@/lib/date.js";
 import { STATES } from "@/store/imports.js";
 import { HTTP } from "@/lib/http";
 import { WFS } from "ol/format.js";
@@ -451,6 +449,9 @@
     formatSurveyDate(date) {
       return formatSurveyDate(date);
     },
+    formatDateTime(date) {
+      return formatDateTime(date);
+    },
     needsApproval(item) {
       return item.status === STATES.NEEDSAPPROVAL;
     },
--- a/client/src/lib/date.js	Tue Feb 19 17:00:32 2019 +0100
+++ b/client/src/lib/date.js	Tue Feb 19 17:06:55 2019 +0100
@@ -24,4 +24,20 @@
     : "";
 };
 
-export { formatSurveyDate };
+const formatDateTime = date => {
+  if (!date) return "";
+  const d = new Date(date);
+  return (
+    d.toLocaleDateString(locale2, {
+      day: "2-digit",
+      month: "2-digit",
+      year: "numeric"
+    }) +
+    " - " +
+    d.toLocaleTimeString(locale2, {
+      hour12: false
+    })
+  );
+};
+
+export { formatSurveyDate, formatDateTime };