{"id":13827818,"url":"https://github.com/simonlc/epoch-timeago","last_synced_at":"2025-07-09T05:30:34.866Z","repository":{"id":57226422,"uuid":"81628596","full_name":"simonlc/epoch-timeago","owner":"simonlc","description":"🕓 Convert unix time to a relative time string e.g., \"4 hours ago\".","archived":false,"fork":false,"pushed_at":"2019-01-15T18:54:08.000Z","size":150,"stargazers_count":27,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T17:16:13.172Z","etag":null,"topics":["npm-package","react","timeago","unix-timestamp"],"latest_commit_sha":null,"homepage":"https://simonlc.github.io/epoch-timeago/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonlc.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-11T03:41:48.000Z","updated_at":"2023-07-01T18:56:44.000Z","dependencies_parsed_at":"2022-08-22T12:31:13.524Z","dependency_job_id":null,"html_url":"https://github.com/simonlc/epoch-timeago","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/simonlc/epoch-timeago","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonlc%2Fepoch-timeago","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonlc%2Fepoch-timeago/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonlc%2Fepoch-timeago/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonlc%2Fepoch-timeago/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonlc","download_url":"https://codeload.github.com/simonlc/epoch-timeago/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonlc%2Fepoch-timeago/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264398967,"owners_count":23602014,"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":["npm-package","react","timeago","unix-timestamp"],"created_at":"2024-08-04T09:02:12.769Z","updated_at":"2025-07-09T05:30:34.617Z","avatar_url":"https://github.com/simonlc.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Epoch TimeAgo\n\n[![NPM][npm]][npm-url]\n[![npm bundle size (minified + gzip)][minzip]][minzip-url]\n![npm downloads](https://img.shields.io/npm/dt/epoch-timeago.svg)\n[![Deps][deps]][deps-url]\n[![Build][build]][build-badge]\n[![Coverage][cover]][cover-badge]\n\nConvert Unix time to a relative time string e.g., \"4 hours ago\".\n\nAs the name implies, only epoch time (Unix time) can be used. The output format is similar to what you would find on Reddit.\n\nThere is zero configuration. Zero dependencies. Minifies to 435 bytes, and gzips to **224 bytes**. 😎\n\n## Examples:\n\n- **seconds** \u003e just now\n- **minutes** \u003e a minute ago, 15 minutes ago\n- **hours** \u003e an hour ago, 2 hours ago\n- **days** \u003e 1 day ago, 2 days ago\n- **weeks** \u003e 1 week ago, 3 weeks ago\n- **months** \u003e 1 month ago, 5 months ago\n- **years** \u003e 1 year ago, 2 years ago\n\n## Install\n\n`yarn add epoch-timeago`\n\nor\n\n`npm install -S epoch-timeago`\n\nThe default build selected will depend on your bundle tool configuration. By default webpack will get the UMD build, and Rollup the esm build. If you want to override this use the following paths:\n\n- UMD build available at `'epoch-timeago/dist'`,\n- Commonjs build available at `'epoch-timeago/lib'`,\n- esm build (ES6+ only) available at `'epoch-timeago/es'`.\n- Source (ES6+ only) available at `'epoch-timeago/src'`.\n\nNOTE: Builds are all minified.\n\n## Usage\n\nSimply pass a Unix time stamp *converted to milliseconds* (`timestampInSeconds * 1000`) and get a time ago formatted string. If your timestamps are in milliseconds no conversion is necessary.\n\n```jsx\nimport timeago from 'epoch-timeago';\n\n// Example of simple usage\nconst timeDiff = timeago(timestamp * 1000)\n\n//Example of formatted string\nconst timeSince = timeago(Date.now() - 60000 * 10);\n// '10 minutes ago'\n```\n\n### In React\n\n```jsx\nimport React from 'react';\nimport timeago from 'epoch-timeago';\n\nconst TimeAgo = ({ time }) =\u003e\n  \u003ctime datetime={new Date(time).toISOString()}\u003e{timeago(time)}\u003c/time\u003e\n\n// ...\n\nconst epochTimeStamp = Date.now() - 60000 * 22;\n\u003cTimeAgo time={epochTimeStamp} /\u003e\n```\n\n## License\n\nMIT\n\n[npm]: https://img.shields.io/npm/v/epoch-timeago.svg\n[npm-url]: https://npmjs.com/package/epoch-timeago\n\n[deps]: https://david-dm.org/simonlc/epoch-timeago.svg\n[deps-url]: https://david-dm.org/simonlc/epoch-timeago\n\n[build]: https://travis-ci.org/simonlc/epoch-timeago.svg?branch=master\n[build-badge]: https://travis-ci.org/simonlc/epoch-timeago?branch=master\n\n[cover]: https://coveralls.io/repos/github/simonlc/epoch-timeago/badge.svg?cache\n[cover-badge]: https://coveralls.io/github/simonlc/epoch-timeago?branch=master\n\n[minzip]: https://img.shields.io/bundlephobia/minzip/epoch-timeago.svg\n[minzip-url]: https://bundlephobia.com/result?p=epoch-timeago\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonlc%2Fepoch-timeago","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonlc%2Fepoch-timeago","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonlc%2Fepoch-timeago/lists"}