Component: Relative Time
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, tailwindcss, typescript
- Ambito
- frontend, internationalization
Direzione di ricerca
Read the existing components under src/registry/components/, then check their exports in src/registry/components/index.ts and entries in src/registry/registry.ts. Build the Relative Time component around the listed API and timing requirements, and add tests in test/ for past and future dates, unit selection, locales, and timer cleanup. It is done when the component, registry entry, tests, and a page in content/docs/components/ are complete.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Component: Relative Time
Show how long ago (or until) a date is, in the user's language: "3 minutes ago", "vor 3 Minuten", "in 2 days".
A first version was removed in #66 until it could be a real component. This issue is for doing it properly.
Requirements
- TypeScript-first with exported props interface
- Uses
Intl.RelativeTimeFormat, picking the largest sensible unit (seconds → minutes → hours → days → weeks → months → years) numeric="auto"by default, so you get "yesterday" / "gestern" rather than "1 day ago"- Renders a semantic
<time dateTime="…">with the absolute date as atitle - Updates itself while on screen, at a rate that fits the distance (every second near "now", every minute after that, …), and stops when unmounted
nowprop for tests and SSR, so the server and client render the same text- Forwarded ref and
...restlike the other components - Tailwind CSS compatible
Expected API
<RelativeTime date={comment.createdAt} locale="de" />
// → <time dateTime="2026-10-28T10:00:00.000Z" title="28. Oktober 2026, 11:00">vor 3 Minuten</time>
Deliverables
- Component source in
src/registry/components/ - Export in
src/registry/components/index.tsand entry insrc/registry/registry.ts - Tests in
test/covering past and future dates, unit selection,numeric="auto", at leasten,deandar, and that the timer is cleared on unmount - Documentation page in
content/docs/components/
See CONTRIBUTING.md and the Contributor Rulebook.
- Lingua principale
- TypeScript
- Stelle
- 39
- Fork
- 16
- Merge medio
- 18h 14m
- PR unite (30g)
- 35
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di babelize/babelize-elements
-
accessibility help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
babelize/babelize-elements#94 ·
I maintainer di solito rispondono entro 1 giorno
-
component help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
babelize/babelize-elements#93 ·
I maintainer di solito rispondono entro 1 giorno
-
Component: Timezone PickerApertacomponent date-time good first issue
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
babelize/babelize-elements#91 ·
I maintainer di solito rispondono entro 1 giorno
-
component good first issue language-switcher
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
babelize/babelize-elements#90 ·
I maintainer di solito rispondono entro 1 giorno
-
component enhancement help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
babelize/babelize-elements#47 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di babelize/babelize-elements
Issue simili
-
needs-area
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/typespec-azure#5936 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
vercel-labs/scriptc#2910 ·
I maintainer di solito rispondono entro 1 giorno
-
automation missing-model model-sync provider:fireworks-ai
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
anomalyco/models.dev#12458 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno