vira
Version:
A simple and highly versatile design system using element-vir.
36 lines (35 loc) • 1.49 kB
TypeScript
import { type PartialWithUndefined } from '@augment-vir/common';
import { type FullDate } from 'date-vir';
/**
* Displays a `FullDate` as an absolute, human readable timestamp in the user's timezone (for
* example `Jun 3, 2026 14:30 PDT`).
*
* @category Time
* @category Elements
* @see https://electrovir.github.io/vira/book/elements/vira-absolute-time
*/
export declare const ViraAbsoluteTime: import("element-vir").DeclarativeElementDefinition<"vira-absolute-time", {
time: Readonly<FullDate>;
} & PartialWithUndefined<{
/** Show only the date part (`Jun 3, 2026`), omitting the time of day and timezone. */
showDateOnly: boolean;
/** Show only the time part (`14:30 PDT`), omitting the date. */
showTimeOnly: boolean;
/**
* Timezone the value 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;
}>, {}, {}, "vira-absolute-time-", "vira-absolute-time-", readonly [], readonly []>;
/**
* Formats a `FullDate` into the same absolute string rendered by {@link ViraAbsoluteTime}.
*
* @category Time
*/
export declare function formatAbsoluteTime(time: Readonly<FullDate>, options?: Readonly<PartialWithUndefined<{
showDateOnly: boolean;
showTimeOnly: boolean;
timezone: string;
}>>): string;