index.tsx644 chars26 lines
This getTimeAgo
function takes a timestamp as input and returns a formatted string describing the time elapsed since the timestamp. The output format is "Xy ago" for years, "Xm ago" for months, "Xd ago" for days, "Xh ago" for hours, "Xm ago" for minutes, and "Xs ago" for seconds.
gistlibby LogSnag