Returns a string representing the time elapsed since the provided timestamp.
@example
// Get the time elapsed since a timestamp without "ago" const timeElapsed =timeAgo(newDate("2022-02-17T12:30:00Z")); console.log(timeElapsed);// Output: "1d" // Get the time elapsed since a timestamp with "ago" const timeElapsedWithAgo =timeAgo(newDate("2022-02-17T12:30:00Z"),{ withAgo:true}); console.log(timeElapsedWithAgo);// Output: "1d ago"
Returns a string representing the time elapsed since the provided timestamp.