Skip to main content

Relative Time

shadow

The RelativeTime component is an element used to display the relative time based on the inserted date. Calculates and displays the relative time difference between the current date and the specified date. The relative time format is localized based on the language of the user's browser.

Basic usage​

The sample shows the basic output of the relative time component, i.e. the conversion of a date to relative time text.

When to use​

Use wje-relative-time to display content that improves the readability, scannability, or context of the information.

When not to use​

Do not use it as a substitute for structured data where precise interaction is needed.

Accessibility​

Add alternative text for images, legible contrasts and text equivalents for icons without description.

  • Compress media and use lazy loading for large lists.
  • Keep information priorities consistent for tabs and lists.
  • Do not repeat the same information in text and icon at the same time with no added value.

Attributes and properties​

date​

PopisNastavuje textovú hodnotu uloženú vo voľbe date.
Atribútdate
Typstring
Predvolené-

lang​

PopisNastavuje jazyk alebo lokalizáciu pre formátovanie a popisy.
Atribútlang
Typany
Predvolené-

objectDate​

PopisRiadi správanie voľby object-date v komponente.
Atribútobject-date
TypDate
Predvolené-

Events​

Pre tento komponent nie sú dostupné žiadne udalosti.

Methods​

getRelativeTimeString​

PopisVráti relative time string z aktuálneho stavu komponentu.
Signatúra(lang: any) => void

isISODate​

PopisOverí, či je isodate aktuálne pravda.
Signatúra(str: string) => boolean

CSS shadow parts​

NázovPopis
nativeŠtýluje koreňovú shadow časť komponentu.

CSS custom variables​

Pre tento komponent nie sú dostupné žiadne vlastné CSS vlastnosti.

Slots​

Pre tento komponent nie sú dostupné žiadne sloty.