Function
Returns a human-readable string representing how long ago a date was.
The date to compare (Date, string or number timestamp)
"Today" if the date is today, otherwise "X day(s) ago"
If the date is invalid
If the date is in the future
dayAgo(new Date('2024-01-01')) // "X days ago"dayAgo('2024-01-01') // "X days ago"dayAgo(1704067200000) // "X days ago" Copy
dayAgo(new Date('2024-01-01')) // "X days ago"dayAgo('2024-01-01') // "X days ago"dayAgo(1704067200000) // "X days ago"
Returns a human-readable string representing how long ago a date was.