Home
GitHub

Locale configuration

Locale configuration comprises values compatible with date.toLocaleString().

For further details about locales, you can refer to the MDN documentation.

The locale configuration takes the following structure:

interface DPLocaleConfig {
  locale?: UnicodeBCP47LocaleIdentifier | Locale | (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
  day?: "2-digit" | "numeric" | undefined;
  weekday?: "long" | "short" | "narrow" | undefined;
  monthName?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined;
  year?: "numeric" | "2-digit" | undefined;
  hour?: "numeric" | "2-digit" | undefined;
  minute?: "numeric" | "2-digit" | undefined;
  second?: "numeric" | "2-digit" | undefined;
  hour12?: boolean | undefined;
  options?: Intl.DateTimeFormatOptions;
}
interface DPLocaleConfig {
  locale?: UnicodeBCP47LocaleIdentifier | Locale | (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined;
  day?: "2-digit" | "numeric" | undefined;
  weekday?: "long" | "short" | "narrow" | undefined;
  monthName?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined;
  year?: "numeric" | "2-digit" | undefined;
  hour?: "numeric" | "2-digit" | undefined;
  minute?: "numeric" | "2-digit" | undefined;
  second?: "numeric" | "2-digit" | undefined;
  hour12?: boolean | undefined;
  options?: Intl.DateTimeFormatOptions;
}

locale

The locale property formats all instances using a string with a BCP 47 language tag.

day

The day property defines the format of the date in Calendars.

weekday

The weekday property determines the format in Weekdays

monthName

The monthName ` - defines the moths format in Months

year

The year property specifies the format of the Years

hour, minute, second and hour12

The hour, minute and second properties determine the appearance of the Time.

Additionally, the hour12 property controls the time format, allowing either a 24-hour format (13:12) or a 12-hour format (01:12 pm).

options

The options property shares the same structure as the Locale configuration except for the absence of the locale field.