codetrix - v1.5.0
    Preparing search index...

    Function setYear

    • Sets the year of the given date and returns a new Date instance.

      Parameters

      • date: Date

        The original date.

      • year: number

        The year to set.

      Returns Date

      A new Date with the updated year.

      setYear(new Date('2024-07-23'), 2025); // → 2025-07-23