vira
Version:
A simple and highly versatile design system using element-vir.
43 lines (42 loc) • 1.72 kB
TypeScript
import { type PartialWithUndefined } from '@augment-vir/common';
import { type AtLeastOneDuration, type FullDate } from 'date-vir';
/**
* Displays a date/time as a live, relative timestamp (for example `5 minutes ago`). The relative
* string automatically updates over time. Optionally renders the absolute timestamp beneath the
* relative string.
*
* @category Time
* @category Elements
* @see https://electrovir.github.io/vira/book/elements/vira-relative-time
*/
export declare const ViraRelativeTime: import("element-vir").DeclarativeElementDefinition<"vira-relative-time", {
time: Readonly<FullDate>;
} & PartialWithUndefined<{
/** When true, the absolute timestamp is rendered beneath the relative string. */
showAbsoluteTime: boolean;
/**
* How long before the relative time updates.
*
* @default {seconds: 5}
*/
updateInterval: Readonly<AtLeastOneDuration>;
/**
* Timezone the absolute time is displayed in. Defaults to the user's timezone. Set this for
* values that are conceptually anchored to a specific timezone (e.g. a date-only value
* stored at midnight UTC), where converting to the user's timezone would shift the
* displayed date/time.
*/
timezone: string;
}>, {
now: {
hour: import("date-vir").Hour;
minute: import("date-vir").Minute;
millisecond: number;
year: number;
month: import("date-vir").MonthNumber;
day: import("date-vir").DayOfMonth;
second: import("date-vir").Second;
timezone: "UTC";
};
timeoutId: undefined | ReturnType<typeof globalThis.setTimeout>;
}, {}, "vira-relative-time-", "vira-relative-time-", readonly [], readonly []>;