convnum
    Preparing search index...

    Function toMonth

    • Converts a month number to a month name in the specified locale and format.

      Parameters

      • monthNumber: number

        Integer between 1-12 representing the month (1 = January, 12 = December)

      • locale: string = 'en-US'

        The locale to use for formatting (default: 'en-US')

      • type: "short" | "long" | "narrow" = 'long'

        The format type, either 'long' (e.g., 'January') or 'short' (e.g., 'Jan') (default: 'long')

      Returns string

      The localized month name as a string

      // Returns "January"
      toMonth(1)
      // Returns "janvier"
      toMonth(1, 'fr-FR')
      // Returns "Jan"
      toMonth(1, 'en-US', 'short')

      Will throw an error if monthNumber is not between 1 and 12