diff client/src/lib/date.js @ 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 4dbed34f8738
children
line wrap: on
line diff
--- 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 };