diff --git a/src/Cat/Cat.tsx b/src/Cat/Cat.tsx
index f1fe2b72..86f44c10 100644
--- a/src/Cat/Cat.tsx
+++ b/src/Cat/Cat.tsx
@@ -29,21 +29,31 @@ const ReportedTime = ({
}: {
reportedAt: string
receivedAt: Date
-}) => (
- <>
-
- {(receivedAt.getTime() - new Date(reportedAt).getTime()) / 1000 > 300 && (
+}) => {
+ try {
+ const r = new Date(reportedAt)
+ return (
+ <>
+
+ {(receivedAt.getTime() - new Date(reportedAt).getTime()) / 1000 >
+ 300 && (
+ <>
+ {' '}
+ {' '}
+
+ >
+ )}
+ >
+ )
+ } catch {
+ return (
<>
- {' '}
{' '}
-
+
>
- )}
- >
-)
+ )
+ }
+}
const ShowCat = ({
catId,
@@ -153,17 +163,22 @@ const ShowCat = ({
if (error) return
return (
<>
- {reported.gps && (
-
- )}
+ {reported.gps &&
+ reported.gps.v &&
+ reported.gps.v.lat &&
+ reported.gps.v.lng && (
+
+ )}
value,
)}
/>
-
+
+
+
>
)}
diff --git a/src/Map/Map.tsx b/src/Map/Map.tsx
index ed319da3..a012c3ef 100644
--- a/src/Map/Map.tsx
+++ b/src/Map/Map.tsx
@@ -54,7 +54,7 @@ export const Map = ({
{label}
{accuracy && }
- {heading !== undefined && heading !== null && (
+ {heading && (
{({ map }) => {
if (map) {
diff --git a/src/RelativeTime/RelativeTime.tsx b/src/RelativeTime/RelativeTime.tsx
index 864eeecd..76c1c932 100644
--- a/src/RelativeTime/RelativeTime.tsx
+++ b/src/RelativeTime/RelativeTime.tsx
@@ -1,10 +1,10 @@
import React, { useState, useEffect } from 'react'
import moment from 'moment'
-const getDiffInSeconds = (ts: string) =>
- (Date.now() - new Date(ts).getTime()) / 1000
+const getDiffInSeconds = (ts: Date) =>
+ (Date.now() - ts.getTime()) / 1000
-export const RelativeTime = ({ ts }: { ts: string }) => {
+export const RelativeTime = ({ ts }: { ts: Date }) => {
const [label, setLabel] = useState(moment(ts).fromNow())
const [diffInSeconds, setDiffInSeconds] = useState(getDiffInSeconds(ts))
@@ -28,5 +28,5 @@ export const RelativeTime = ({ ts }: { ts: string }) => {
}
}, [diffInSeconds, ts])
- return
+ return
}