Relative Time
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.
Recommended practices
- 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
| Popis | Nastavuje textovú hodnotu uloženú vo voľbe date. |
| Atribút | date |
| Typ | string |
| Predvolené | - |
lang
| Popis | Nastavuje jazyk alebo lokalizáciu pre formátovanie a popisy. |
| Atribút | lang |
| Typ | any |
| Predvolené | - |
objectDate
| Popis | Riadi správanie voľby object-date v komponente. |
| Atribút | object-date |
| Typ | Date |
| Predvolené | - |
Events
Pre tento komponent nie sú dostupné žiadne udalosti.
Methods
getRelativeTimeString
| Popis | Vráti relative time string z aktuálneho stavu komponentu. |
| Signatúra | (lang: any) => void |
isISODate
| Popis | Overí, či je isodate aktuálne pravda. |
| Signatúra | (str: string) => boolean |
CSS shadow parts
| Názov | Popis |
|---|---|
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.