convnum
    Preparing search index...

    Function toDayOfWeek

    • Converts a day number to a day name in the specified locale and format. Uses 0-based indexing for days (0 = Sunday, 6 = Saturday).

      Parameters

      • dayNumber: number

        Integer between 0-6 representing the day of the week (0 = Sunday, 6 = Saturday)

      • 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., 'Sunday') or 'short' (e.g., 'Sun') (default: 'long')

      Returns string

      The localized day name as a string

      // Returns "Sunday"
      toDayOfWeek(0)
      // Returns "lundi"
      toDayOfWeek(1, 'fr-FR')
      // Returns "Di"
      toDayOfWeek(2, 'de-DE', 'short')

      Will throw an error if dayNumber is not between 0 and 6