Calendar
One of the user's calendar settings, for showing dates, times and weeks the way the user reads them.
Utilisation
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);
}Déclaration du type
export type Calendar = CalendarInfo;Membres 4
| Nom | Type | Requis | Description |
|---|---|---|---|
calendar | string | Oui | The CLDR identifier, as gregory, buddhist or japanese. |
timeZone | string | Oui | IANA, as Europe/Lisbon. |
uses24hourClock | boolean | Oui | — |
firstWeekday | number | Oui | 1 is Sunday, 7 is Saturday. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.