copyright-years - v1.0.0
    Preparing search index...

    Function copyrightYears

    • Generates a dynamic copyright year range string.

      The function clamps invalid or future values to the current year.

      Parameters

      • startYear: number = ...

        The initial year the copyright started. Defaults to the current year.

      Returns string

      The formatted copyright year or year range (e.g., "2026" or "2024-2026").

      // If the current year is 2026:
      copyrightYears(2024); // returns "2024-2026"
      copyrightYears(2026); // returns "2026"
      copyrightYears(2030); // returns "2026"
      copyrightYears(-1); // returns "2026"
      copyrightYears('invalid'); // returns "2026"