From 6ebc0a1a0894375cce32cbb93e86c85b2dfc351e Mon Sep 17 00:00:00 2001 From: noahtalerman <47070608+noahtalerman@users.noreply.github.com> Date: Wed, 14 Apr 2021 16:21:00 -0700 Subject: [PATCH] Handle hosts that have not had details updated in "Hosts" table (#642) - Render "Never" in the "Last fetched" column if the value of `detail_updated_at` is improbable. Resolves #639 --- frontend/kolide/helpers.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/kolide/helpers.ts b/frontend/kolide/helpers.ts index 8a3f092808..64d1e22b2b 100644 --- a/frontend/kolide/helpers.ts +++ b/frontend/kolide/helpers.ts @@ -291,6 +291,13 @@ export const humanHostMemory = (bytes: number): string => { }; export const humanHostDetailUpdated = (detailUpdated: string): string => { + // Handles the case when a host has checked in to Fleet but + // its details haven't been updated. + // July 28, 2016 is the date of the initial commit to kolide/fleet. + if (detailUpdated < "2016-07-28T00:00:00Z") { + return "Never"; + } + return moment(detailUpdated).fromNow(); };