Component: Relative Time

オープン
#92 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, tailwindcss, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

component date-time good first issue

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 a title
  • Updates itself while on screen, at a rate that fits the distance (every second near "now", every minute after that, …), and stops when unmounted
  • now prop for tests and SSR, so the server and client render the same text
  • Forwarded ref and ...rest like 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.ts and entry in src/registry/registry.ts
  • Tests in test/ covering past and future dates, unit selection, numeric="auto", at least en, de and ar, and that the timer is cleared on unmount
  • Documentation page in content/docs/components/

See CONTRIBUTING.md and the Contributor Rulebook.

主要言語
TypeScript
スター
39
フォーク
16
平均マージ
18時間 14分
マージ済み PR(30日)
35

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

babelize/babelize-elements のほかの issue

babelize/babelize-elements の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。