From 6ffcf986ccf19766748f57e9a5995f3b2c0b6063 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Fri, 8 Nov 2024 12:42:07 -0500 Subject: [PATCH] fix(transit-vehicle-overlay): use correct+consistent time units --- packages/transit-vehicle-overlay/src/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/transit-vehicle-overlay/src/index.tsx b/packages/transit-vehicle-overlay/src/index.tsx index 7afc520de..733931d3e 100644 --- a/packages/transit-vehicle-overlay/src/index.tsx +++ b/packages/transit-vehicle-overlay/src/index.tsx @@ -83,11 +83,12 @@ const TransitVehicleOverlay = ({ VehicleIcon = DefaultVehicleIcon, vehicles }: Props): ReactNode => { + const dateSeconds = Date.now() / 1000; const validVehicles = vehicles?.filter( vehicle => !!vehicle?.lat && !!vehicle?.lon && - Date.now() - (vehicle?.lastUpdated || Date.now()) < maxVehicleAge + dateSeconds - (vehicle?.lastUpdated || dateSeconds) < maxVehicleAge ); // Don't render if no map or no vehicles are defined. // (ZoomBasedMarkers will also not render below the minimum zoom threshold defined in the symbols prop.)