{"id":16564910,"url":"https://github.com/k-yle/react-timeago-i18n","last_synced_at":"2025-09-15T08:57:04.258Z","repository":{"id":166745389,"uuid":"642276581","full_name":"k-yle/react-timeago-i18n","owner":"k-yle","description":"📅🌏 A tiny relative time component for react, using the browser's native internationalization API","archived":false,"fork":false,"pushed_at":"2025-03-09T01:49:57.000Z","size":910,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T01:51:49.597Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.im/react-timeago-i18n","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k-yle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-18T07:55:35.000Z","updated_at":"2025-03-09T01:50:02.000Z","dependencies_parsed_at":"2024-10-28T10:23:21.924Z","dependency_job_id":null,"html_url":"https://github.com/k-yle/react-timeago-i18n","commit_stats":null,"previous_names":["k-yle/react-timeago-i18n"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Freact-timeago-i18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Freact-timeago-i18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Freact-timeago-i18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k-yle%2Freact-timeago-i18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k-yle","download_url":"https://codeload.github.com/k-yle/react-timeago-i18n/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244135891,"owners_count":20403797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T20:45:24.216Z","updated_at":"2025-03-21T11:32:59.604Z","avatar_url":"https://github.com/k-yle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-timeago-i18n\n\n[![build](https://github.com/k-yle/react-timeago-i18n/actions/workflows/ci.yml/badge.svg)](https://github.com/k-yle/react-timeago-i18n/actions/workflows/ci.yml)\n[![npm version](https://badge.fury.io/js/react-timeago-i18n.svg)](https://badge.fury.io/js/react-timeago-i18n)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-timeago-i18n)\n\n📅🌏 A tiny relative time component for react, which uses the browser's native [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat) API.\nThis means that all languages are supported without bundling translations.\n\nThis library is `0.8 kB`, which is significantly smaller than `react-timeago` which is `96 kB`.\n\n## Install\n\n```sh\nnpm install react-timeago-i18n\n```\n\n## Usage\n\n```tsx\nimport TimeAgo from \"react-timeago-i18n\";\n\n\u003cTimeAgo date=\"2019-07-16\" /\u003e // --\u003e \"4 years ago\"\n\u003cTimeAgo date=\"2019-07-16\" locale=\"de-AT\" /\u003e // --\u003e \"vor 4 Jahren\"\n```\n\n## Props\n\n| Property          | Description                                                                                                                                                          | Default Value        |\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|\n| `date`            | `string` or `Date`                                                                                                                                                   | -                    |\n| `locale`          | the language to use                                                                                                                                                  | `navigator.language` |\n| `formatOptions`   | [options for `Intl.RelativeTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#basic_format_usage) | `undefined`          |\n| `allowFuture`     | By default, only dates in the _past_ are supported. If you want to display future dates (i.e. \"in 3 days\") set this property to `true`                               | `false`              |\n| `hideSeconds`     | By default, values smaller than 1 minute will shown as \"1 minute\" instead of frequently updating seconds, unless you set this property to `false`.                   | `true`               |\n| `hideSecondsText` | When using `hideSeconds`, seconds are displayed as \"1 minute ago\" or \"in 1 minute\", use this property to provide custom strings i.e. `[\"just now\", \"right now\"]`     | `[]`                 |\n| `roundStrategy`   | By default, values are `round`ed (e.g. 11.9 months becomes \"2 years\"). If this is not desired, the rounding strategy can be changed to `floor`.                      | `\"round\"`            |\n| `timeElement`     | By default, the result is wrapped in `\u003ctime title=\"...\"\u003e ... \u003c/time\u003e`, unless you set this property to `false`                                                       | `true`               |\n\n## Context Provider\n\nOptions can be specified as props, or using a context provider.\n\nFor example:\n\n```tsx\nimport TimeAgo, { TimeAgoProvider } from \"react-timeago-i18n\";\n\n\u003cTimeAgoProvider locale=\"zh-Hans\" hideSeconds\u003e\n  ...\n  \u003cTimeAgo date=\"2019-07-16\" /\u003e\n  ...\n\u003c/TimeAgoProvider\u003e;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-yle%2Freact-timeago-i18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk-yle%2Freact-timeago-i18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk-yle%2Freact-timeago-i18n/lists"}