@oss-autopilot/core - v1.6.3
    Preparing search index...

    Function daysBetween

    • Calculates the number of whole days between two dates, using floor rounding.

      Can return negative values if from is after to. Partial days are truncated (e.g., 1.9 days returns 1).

      Parameters

      • from: Date

        The start date

      • to: Date = ...

        The end date (defaults to the current date/time)

      Returns number

      Number of whole days between the two dates (may be negative)

      daysBetween(new Date('2024-01-01'), new Date('2024-01-10'))
      // 9
      daysBetween(new Date('2024-01-10'), new Date('2024-01-01'))
      // -9