@unikue/ts-lang-utils
    Preparing search index...

    Function addMonth

    • Returns the month calculated date with the source date and the specified amount

      If the target month does not have the same day, the result is clamped to the last day of the target month

      Parameters

      • Optionaldate: Date

        The date to inspect

      • Optionalamount: number

        The amount to add, negative number means minus

      Returns Date | undefined

      the month calculated date with the source date and the specified amount

      David Hsing

      addMonth(new Date(2023, 8, 30), 1);    // Date(2023, 9, 30)
      addMonth(new Date(2023, 0, 31), 1); // Date(2023, 1, 28)
      addMonth(new Date(2023, 2, 31), -1); // Date(2023, 1, 28)