import React from "react"; import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict"; import TooltipWrapper from "components/TooltipWrapper"; const baseClass = "component__last-updated-text"; const renderLastUpdatedText = ( lastUpdatedAt: string, whatToRetrieve: string ): JSX.Element => { if (!lastUpdatedAt || lastUpdatedAt === "0001-01-01T00:00:00Z") { lastUpdatedAt = "never"; } else { lastUpdatedAt = formatDistanceToNowStrict(new Date(lastUpdatedAt), { addSuffix: true, }); } return ( {`Last updated ${lastUpdatedAt}`} ); }; export default renderLastUpdatedText;