clear-af.js
    Preparing search index...

    Function dayAgo

    • Function

      Returns a human-readable string representing how long ago a date was.

      Parameters

      • date: DateParam

        The date to compare (Date, string or number timestamp)

      Returns string

      "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"