chronia
    Preparing search index...

    Type Alias Locale

    Localization interface for formatting date/time components.

    Provides methods to localize various date/time components based on locale-specific formats. Each method accepts an optional width parameter to control the output format:

    • "narrow": Shortest possible representation (e.g., "M" for Monday)
    • "abbreviated": Short form (e.g., "Mon" for Monday)
    • "wide": Full form (e.g., "Monday")
    type Locale = {
        dayPeriod: (
            period: "am" | "pm",
            options?: { width: "narrow" | "abbreviated" | "wide" },
        ) => string;
        era: (
            era: 0 | 1,
            options?: { width: "narrow" | "abbreviated" | "wide" },
        ) => string;
        month: (
            month: number,
            options?: { width: "narrow" | "abbreviated" | "wide" },
        ) => string;
        weekday: (
            weekday: number,
            options?: { width: "narrow" | "abbreviated" | "wide" },
        ) => string;
    }
    Index

    Properties

    dayPeriod: (
        period: "am" | "pm",
        options?: { width: "narrow" | "abbreviated" | "wide" },
    ) => string

    Format day period (AM/PM).

    Type Declaration

      • (
            period: "am" | "pm",
            options?: { width: "narrow" | "abbreviated" | "wide" },
        ): string
      • Parameters

        • period: "am" | "pm"

          "am" for morning, "pm" for afternoon/evening

        • Optionaloptions: { width: "narrow" | "abbreviated" | "wide" }
          • width: "narrow" | "abbreviated" | "wide"

            Format width: "narrow", "abbreviated", or "wide"

        Returns string

        Localized day period string

    era: (
        era: 0 | 1,
        options?: { width: "narrow" | "abbreviated" | "wide" },
    ) => string

    Format era (BC/AD).

    Type Declaration

      • (era: 0 | 1, options?: { width: "narrow" | "abbreviated" | "wide" }): string
      • Parameters

        • era: 0 | 1

          0 for BC (Before Christ), 1 for AD (Anno Domini)

        • Optionaloptions: { width: "narrow" | "abbreviated" | "wide" }
          • width: "narrow" | "abbreviated" | "wide"

            Format width: "narrow", "abbreviated", or "wide"

        Returns string

        Localized era string

    month: (
        month: number,
        options?: { width: "narrow" | "abbreviated" | "wide" },
    ) => string

    Format month name.

    Type Declaration

      • (month: number, options?: { width: "narrow" | "abbreviated" | "wide" }): string
      • Parameters

        • month: number

          Month index (0-11, where 0 is January)

        • Optionaloptions: { width: "narrow" | "abbreviated" | "wide" }
          • width: "narrow" | "abbreviated" | "wide"

            Format width: "narrow", "abbreviated", or "wide"

        Returns string

        Localized month name

    weekday: (
        weekday: number,
        options?: { width: "narrow" | "abbreviated" | "wide" },
    ) => string

    Format weekday name.

    Type Declaration

      • (
            weekday: number,
            options?: { width: "narrow" | "abbreviated" | "wide" },
        ): string
      • Parameters

        • weekday: number

          Weekday index (0-6, where 0 is Sunday)

        • Optionaloptions: { width: "narrow" | "abbreviated" | "wide" }
          • width: "narrow" | "abbreviated" | "wide"

            Format width: "narrow", "abbreviated", or "wide"

        Returns string

        Localized weekday name