Skip to content

Commit

Permalink
Merge pull request #1395 from flanksource/1394-crd-config-scrapers-cr…
Browse files Browse the repository at this point in the history
…eated-date-2000y-ago

fix: don't return relative date if it's 0001-01-01T00:00:00+00:00
  • Loading branch information
moshloop authored Sep 14, 2023
2 parents 1961111 + aa4f0f6 commit ba73be4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ export const relativeDateTime = (
from: string | Date,
to = dayjs().toISOString()
) => {
if (dayjs(from).isSame(dayjs("0001-01-01T00:00:00+00:00"))) {
return "";
}
const fromDate = dayjs.utc(from).local();

return fromDate.fromNow();
};

Expand Down

0 comments on commit ba73be4

Please sign in to comment.