{"_id":"@elrond25/relative-date","_rev":"4-0d2f1f53cdbb8773ef54ca6ec27d4f30","name":"@elrond25/relative-date","dist-tags":{"latest":"1.2.0"},"versions":{"0.0.0":{"name":"@elrond25/relative-date","version":"0.0.0","_id":"@elrond25/relative-date@0.0.0","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"dist":{"shasum":"fa53d546781add65e1346eb425291b827b1d75ab","tarball":"https://registry.npmjs.org/@elrond25/relative-date/-/relative-date-0.0.0.tgz","fileCount":17,"integrity":"sha512-CH+2AfbFCzh4dndmw9GSliemh/s1ybzGrhLG7YRDnUmwC+3j1r/+iSS5C8ddOE1o4XdpqtG9eczR+6mHkUqXGA==","signatures":[{"sig":"MEUCIFTwbjlphacaun3g92cPOl4V7aYGn+7Zgn5zPfR3SoBlAiEA62Jrns2C4bEKrbmPxrN9Uu/Wi+1ueNXzDOgRGEWq4w8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20655},"main":"./dist/relative-date.js","type":"module","module":"./dist/relative-date.js","exports":{".":"./dist/relative-date.js"},"gitHead":"1956449c24b645a9480e8cd67e05c143633fa622","private":false,"scripts":{"dev":"vite","lint":"eslint .","build":"tsc -b && vite build","preview":"vite preview"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"_npmVersion":"11.8.0","description":"A lightweight, modern React component for displaying relative dates (e.g., \"2 years ago\", \"3 days ago\") using the ECMAScript `Temporal` API and `Intl.ListFormat`.","directories":{},"_nodeVersion":"24.13.1","dependencies":{"react":"^19.2.0","react-dom":"^19.2.0","temporal-polyfill":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.1","eslint":"^9.39.1","globals":"^16.5.0","@eslint/js":"^9.39.1","typescript":"~5.9.3","@types/node":"^24.10.1","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","typescript-eslint":"^8.48.0","@vitejs/plugin-react":"^5.1.1","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-react-refresh":"^0.4.24"},"_npmOperationalInternal":{"tmp":"tmp/relative-date_0.0.0_1771225578498_0.9302601701122335","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@elrond25/relative-date","version":"1.0.0","_id":"@elrond25/relative-date@1.0.0","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"dist":{"shasum":"b54cdc4012997e9cb8b88321aa54aa45519f6df9","tarball":"https://registry.npmjs.org/@elrond25/relative-date/-/relative-date-1.0.0.tgz","fileCount":17,"integrity":"sha512-KH2VaYZPSwch/JuJGtI/UuMQqYpM9Fe0raHVtrNhMr15TeJvkXoKe3CjbpRNw+RZMb/Y53fasZl/VgYQx5pQLQ==","signatures":[{"sig":"MEQCIFb5F0VhHf+X0cahmX+4iSXUM4Mpfh+GulzIky+dkqWmAiAckU3CJlGZks/YLT5GX4rLrTCHjvf/g5AtVKol6VouhA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20661},"main":"./dist/relative-date.js","type":"module","module":"./dist/relative-date.js","exports":{".":"./dist/relative-date.js"},"gitHead":"87050056a77b30ca0c42a52845c5497fa7f566b4","scripts":{"dev":"vite","lint":"eslint .","build":"tsc -b && vite build","preview":"vite preview"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"_npmVersion":"11.8.0","description":"A lightweight, modern React component for displaying relative dates (e.g., \"2 years ago\", \"3 days ago\") using the ECMAScript `Temporal` API and `Intl.ListFormat`.","directories":{},"_nodeVersion":"24.13.1","dependencies":{"react":"^19.2.0","react-dom":"^19.2.0","temporal-polyfill":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.1","eslint":"^9.39.1","globals":"^16.5.0","@eslint/js":"^9.39.1","typescript":"~5.9.3","@types/node":"^24.10.1","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","typescript-eslint":"^8.48.0","@vitejs/plugin-react":"^5.1.1","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-react-refresh":"^0.4.24"},"_npmOperationalInternal":{"tmp":"tmp/relative-date_1.0.0_1771262927447_0.01534131319991383","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@elrond25/relative-date","version":"1.0.1","license":"MIT","_id":"@elrond25/relative-date@1.0.1","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"dist":{"shasum":"4c45f7cdaf1e1c182f7eb4d0c568a1b7a21d94b0","tarball":"https://registry.npmjs.org/@elrond25/relative-date/-/relative-date-1.0.1.tgz","fileCount":17,"integrity":"sha512-J0Q2WlOPZ/cAdWcsid4rGNam5Fpq5yySBLBjFKARZ500LqEpHhd8z0W+i0uinnCY7uCdBXSCLDtCL2a5v7JExg==","signatures":[{"sig":"MEYCIQCSvNOwEcEGLuop3qV6j3iHQk/vXt8Jipp8EVTE6j3QXwIhAI7uB2ANZLXV2dKDGW8HOW9fmE/CXNGdK08Kcs7U6t4j","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20681},"main":"./dist/relative-date.js","type":"module","module":"./dist/relative-date.js","exports":{".":"./dist/relative-date.js"},"gitHead":"345c7b51dd051a38eb34ac5bf0228386ab0246df","scripts":{"dev":"vite","lint":"eslint .","build":"tsc -b && vite build","preview":"vite preview"},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"_npmVersion":"11.8.0","description":"A lightweight, modern React component for displaying relative dates (e.g., \"2 years ago\", \"3 days ago\") using the ECMAScript `Temporal` API and `Intl.ListFormat`.","directories":{},"_nodeVersion":"24.13.1","dependencies":{"react":"^19.2.0","react-dom":"^19.2.0","temporal-polyfill":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.1","eslint":"^9.39.1","globals":"^16.5.0","@eslint/js":"^9.39.1","typescript":"~5.9.3","@types/node":"^24.10.1","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","typescript-eslint":"^8.48.0","@vitejs/plugin-react":"^5.1.1","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-react-refresh":"^0.4.24"},"_npmOperationalInternal":{"tmp":"tmp/relative-date_1.0.1_1771263849287_0.7138444273840037","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@elrond25/relative-date","version":"1.2.0","type":"module","main":"./dist/relative-date.js","module":"./dist/relative-date.js","exports":{".":"./dist/relative-date.js"},"license":"MIT","scripts":{"dev":"vite","build":"tsc -b && vite build","lint":"eslint .","preview":"vite preview"},"dependencies":{"react":"^19.2.0","react-dom":"^19.2.0","temporal-polyfill":"^0.3.0"},"devDependencies":{"@eslint/js":"^9.39.1","@types/node":"^24.10.1","@types/react":"^19.2.7","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^5.1.1","eslint":"^9.39.1","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-react-refresh":"^0.4.24","globals":"^16.5.0","typescript":"~5.9.3","typescript-eslint":"^8.48.0","vite":"^7.3.1"},"gitHead":"c40cd1c995175e31f4c050ff273fbc912f371d1b","_id":"@elrond25/relative-date@1.2.0","description":"A lightweight, modern React component for displaying relative dates (e.g., \"2 years ago\", \"3 days ago\") using the ECMAScript `Temporal` API and `Intl.ListFormat`.","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-LYPng4EiBR8SOlihum76AYVfw5OMZlBgMPWN8upiURJ63vT6EH1jYk32vg/aKJzPqsXfVlh8o6WQhbk6KOeB7Q==","shasum":"434bae6d2f953d380de1a5216b1b9655fab17c91","tarball":"https://registry.npmjs.org/@elrond25/relative-date/-/relative-date-1.2.0.tgz","fileCount":18,"unpackedSize":21779,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD8b3Xn7kMbseLq2EV8ZM2sqiqHwV6dA28it1jI2OuNbwIhANfwEACf2MXiePsMH+iZxUckAyTmDeuyeZ6XS6S4rrX7"}]},"_npmUser":{"name":"elrond25","email":"carlos.araya@gmail.com"},"directories":{},"maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/relative-date_1.2.0_1771264357510_0.061807295889082736"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-16T07:06:18.413Z","modified":"2026-02-16T17:52:37.778Z","0.0.0":"2026-02-16T07:06:18.644Z","1.0.0":"2026-02-16T17:28:47.574Z","1.0.1":"2026-02-16T17:44:09.429Z","1.2.0":"2026-02-16T17:52:37.657Z"},"license":"MIT","description":"A lightweight, modern React component for displaying relative dates (e.g., \"2 years ago\", \"3 days ago\") using the ECMAScript `Temporal` API and `Intl.ListFormat`.","maintainers":[{"name":"elrond25","email":"carlos.araya@gmail.com"}],"readme":"# relative-date\n\nA lightweight, modern React component for displaying relative dates (e.g., \"2 years ago\", \"3 days ago\") using the ECMAScript `Temporal` API and `Intl.ListFormat`.\n\nThis library avoids heavy dependencies like `moment.js` or `date-fns` by leveraging modern browser capabilities.\n\n## Features\n\n- **Modern API**: Built on the `Temporal` API for precise date calculations.\n- **Internationalization**: Uses `Intl.ListFormat` for grammatically correct lists (e.g., \"1 year and 3 months ago\").\n- **Customizable**: Supports custom locales and CSS classes.\n- **Accessible**: Renders a semantic `<time>` element.\n- **Tiny**: Zero runtime dependencies (besides `react` peer dependency).\n\n## Prerequisites\n\nThis library relies on the **[Temporal API](https://tc39.es/proposal-temporal/)**, which is currently a Stage 3 proposal.\n\n> **Note:** This library automatically polyfills `Temporal` if it is not supported in the user's environment. The polyfill is loaded dynamically to strip bundle size on modern browsers.\n\n## Installation\n\n```bash\nnpm install relative-date\n# or\nyarn add relative-date\n# or\npnpm add relative-date\n```\n\n## Usage\n\nImport the `TimeAgo` component and pass it an ISO date string.\n\n```tsx\nimport { TimeAgo } from 'relative-date';\n\nfunction App() {\n  const dateStr = \"2023-11-15T10:00:00.000Z\";\n\n  return (\n    <div>\n      <h3>Post details</h3>\n      <p>\n        Posted: <TimeAgo date={dateStr} />\n      </p>\n      \n      {/* With custom locale (Spanish) */}\n      <p>\n        Publicado: <TimeAgo date={dateStr} locale=\"es-ES\" />\n      </p>\n    </div>\n  );\n}\n```\n\n## Props\n\n| Prop | Type | Default | Description |\n| ------ | ------ | --------- | ------------- |\n| `date` | `string` | **Required** | The ISO date string to calculate from (e.g., \"2025-12-09\"). |\n| `locale` | `string` | `'en-US'` | BCP 47 language tag (e.g., \"fr-FR\", \"es-ES\"). |\n| `className` | `string` | `''` | CSS class for custom styling. |\n| `errorFallback` | `string` | `'Invalid date'` | Text to display if the date is invalid or calculation fails. |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}