@mindfulness/utils
    Preparing search index...

    Function addYears

    • Type Parameters

      • DateType extends Date

        The Date type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like UTCDate.

      • ResultDate extends Date = DateType

        The result Date type.

      Parameters

      • date: DateArg<DateType>

        The date to be changed

      • amount: number

        The amount of years to be added.

      • Optionaloptions: AddYearsOptions<ResultDate>

        The options

      Returns ResultDate

      The new date with the years added

      addYears

      Add the specified number of years to the given date.

      // Add 5 years to 1 September 2014:
      const result = addYears(new Date(2014, 8, 1), 5)
      //=> Sun Sep 01 2019 00:00:00