localization.Calendar
One of the user's calendar settings, for showing dates, times and weeks the way the user reads them.
Verwendung
Format a clock using the device's calendar preferences.
// Format a clock using the device's calendar preferences.
import { localization, type Calendar } from 'kuito';
export function clockLabel(date: Date): string {
const calendar: Calendar | undefined = localization.calendars.value[0];
return new Intl.DateTimeFormat(localization.locales.value[0]?.languageTag, {
hour: 'numeric',
minute: '2-digit',
timeZone: calendar?.timeZone ?? undefined,
hour12: calendar?.uses24hourClock == null ? undefined : !calendar.uses24hourClock,
}).format(date);
}Typdeklaration
export type Calendar = CalendarInfo;Mitglieder 4
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
calendar | string | Ja | The CLDR identifier, as gregory, buddhist or japanese. |
timeZone | string | Ja | IANA, as Europe/Lisbon. |
uses24hourClock | boolean | Ja | — |
firstWeekday | number | Ja | 1 is Sunday, 7 is Saturday. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.