Calendar
One of the user's calendar settings, for showing dates, times and weeks the way the user reads them.
Utilização
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);
}Declaração do tipo
export type Calendar = CalendarInfo;Membros 4
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
calendar | string | Sim | The CLDR identifier, as gregory, buddhist or japanese. |
timeZone | string | Sim | IANA, as Europe/Lisbon. |
uses24hourClock | boolean | Sim | — |
firstWeekday | number | Sim | 1 is Sunday, 7 is Saturday. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.