{"id":17768104,"url":"https://github.com/quisido/relative-timestamp","last_synced_at":"2026-07-02T16:32:28.971Z","repository":{"id":57157007,"uuid":"379041238","full_name":"quisido/relative-timestamp","owner":"quisido","description":"Calculates and re-renders a best-fit relative timestamp in React","archived":false,"fork":false,"pushed_at":"2021-06-22T00:01:01.000Z","size":669,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-29T07:07:34.616Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/quisido.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-21T19:27:09.000Z","updated_at":"2021-06-22T00:01:03.000Z","dependencies_parsed_at":"2022-09-03T16:51:09.321Z","dependency_job_id":null,"html_url":"https://github.com/quisido/relative-timestamp","commit_stats":null,"previous_names":["quisido/relative-timestamp","charlesstover/relative-timestamp"],"tags_count":0,"template":false,"template_full_name":"CharlesStover/node-package-template","purl":"pkg:github/quisido/relative-timestamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quisido%2Frelative-timestamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quisido%2Frelative-timestamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quisido%2Frelative-timestamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quisido%2Frelative-timestamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quisido","download_url":"https://codeload.github.com/quisido/relative-timestamp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quisido%2Frelative-timestamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013971,"owners_count":26085429,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-26T20:55:45.818Z","updated_at":"2025-10-14T00:46:59.613Z","avatar_url":"https://github.com/quisido.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `RelativeTimestamp`\n\n[![version](https://img.shields.io/npm/v/relative-timestamp.svg)](https://www.npmjs.com/package/relative-timestamp)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/relative-timestamp.svg)](https://www.npmjs.com/package/relative-timestamp)\n[![downloads](https://img.shields.io/npm/dt/relative-timestamp.svg)](https://www.npmjs.com/package/relative-timestamp)\n\n`RelativeTimestamp` is a React component for formatting Unix timestamps in\nrelative time, e.g. `Now`, `12 days ago`, or `1 year ago`.\n\n## Install\n\n- `npm install relative-timestamp` or\n- `yarn add relative-timestamp`\n\n## Use\n\n```javascript\nimport RelativeTimestamp from 'relative-timestamp';\n\nconst MY_DATE = new Date(2000, 4, 20);\nconst MY_TIMESTAMP = MY_DATE.getTime();\n\n// In the year 2021, this will output \"21 years ago.\"\nfunction MyRelativeTimestamp() {\n  return \u003cRelativeTimestamp value={MY_TIMESTAMP} /\u003e;\n}\n```\n\n## Supported time units\n\nThe `RelativeTimestamp` component supports _now_, minutes, hours, days, months,\nand years.\n\n_Seconds_ are not supported and are instead represented as _Now_. Rendering\ntimestamps from seconds ago would be too noisy to animate and have too poor of\nperformance to re-render every second. Instead of \"X seconds ago\" ticking up\nevery second, the component instead renders \"Now\" and re-renders on the _minute_\nmark.\n\n## API\n\n### `children`\n\nType: `(unit, count) =\u003e ReactNode` (optional)\n\nIf you want to provide custom internationalization, logic, or styling on your\ndisplay, you can optionally pass a `children` prop that accepts the unit and\ncount.\n\nFor example,\n\n```javascript\nconst MY_DATE = new Date(2000, 4, 20);\nconst MY_TIMESTAMP = MY_DATE.getTime();\n\nfunction MyRelativeTimestamp() {\n  return (\n    \u003cRelativeTimestamp value={MY_TIMESTAMP}\u003e\n      {(unit, count) =\u003e {\n        switch (unit) {\n          case 'now':\n            return \u003cI18n\u003enow\u003c/I18n\u003e;\n          case 'days':\n          case 'hours':\n          case 'minutes':\n          case 'months':\n          case 'years':\n            return \u003cI18n count={count}\u003e{unit}_ago\u003c/I18n\u003e;\n        }\n      }}\n    \u003c/RelativeTimestamp\u003e\n  );\n}\n```\n\n### `value`\n\nType: `number` (required)\n\nThe `value` prop should be the Unix timestamp that you want to display\nrelatively.\n\n## Contributing\n\n- `yarn set version latest`\n- `yarn up * @*/*`\n- `yarn add --dev @yarnpkg/pnpify`\n- `yarn pnpify --sdk vscode`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquisido%2Frelative-timestamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquisido%2Frelative-timestamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquisido%2Frelative-timestamp/lists"}