convnum
    Preparing search index...

    Function fromMonth

    • Converts a month name to its corresponding number in the specified locale. Performs a case-insensitive comparison with both long and short month names.

      Parameters

      • monthName: string

        The name of the month to convert (e.g., "January", "Jan", "janvier")

      • locale: string = 'en-US'

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

      Returns null | number

      The month number (1-12) or null if not found

      // Returns 1
      fromMonth('January')
      // Returns 1
      fromMonth('jan', 'fr-FR')
      // Returns 12
      fromMonth('Dez', 'de-DE')