{"id":19240786,"url":"https://github.com/aharshac/react-relative-time","last_synced_at":"2025-04-21T08:32:34.298Z","repository":{"id":57343441,"uuid":"88856421","full_name":"aharshac/react-relative-time","owner":"aharshac","description":"React Component for rendering relative dates as \u003ctime\u003e HTML5 elements.","archived":false,"fork":false,"pushed_at":"2017-04-20T20:08:47.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-16T02:56:47.156Z","etag":null,"topics":["date-time","nodejs","nodejs-modules","react","react-component"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/aharshac.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":"2017-04-20T11:07:40.000Z","updated_at":"2022-02-11T11:00:56.000Z","dependencies_parsed_at":"2022-09-12T07:00:29.700Z","dependency_job_id":null,"html_url":"https://github.com/aharshac/react-relative-time","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aharshac%2Freact-relative-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aharshac%2Freact-relative-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aharshac%2Freact-relative-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aharshac%2Freact-relative-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aharshac","download_url":"https://codeload.github.com/aharshac/react-relative-time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250023590,"owners_count":21362433,"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":["date-time","nodejs","nodejs-modules","react","react-component"],"created_at":"2024-11-09T17:09:00.373Z","updated_at":"2025-04-21T08:32:34.054Z","avatar_url":"https://github.com/aharshac.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Relative Time\n\n[![Collaborizm](https://img.shields.io/badge/Collaborizm-Join%20now-blue.svg)](https://www.collaborizm.com/) [![Build Status](https://travis-ci.org/aharshac/react-relative-time.svg?branch=master)](https://travis-ci.org/aharshac/react-relative-time)    \n\n [![NPM](https://nodei.co/npm/react-relative-time.png?mini=true)](https://nodei.co/npm/react-relative-time/)\n\n\nReact Component for rendering relative dates as `\u003ctime\u003e` HTML5 element and preserving machine readable format in `datetime`\nattribute.\n\nDoes not depend on [**moment.js**](https://github.com/moment/moment)\n\n\u0026nbsp;\n\n## Acknowledgement\nThis module was inspired by a few awesome open source projects.\n* [**moment.js**](https://github.com/moment/moment)\n* [**react-time**](https://github.com/andreypopp/react-time)\n* [**timeago**](http://timeago.yarp.com/)\n\n\u0026nbsp;\n\n## Installation\n```\nnpm install react-relative-time\n```  \n\n\u0026nbsp;\n\n## Usage\n\n```jsx\nimport React from 'react'\nimport RelativeTime from 'react-relative-time'\n\nclass MyComponent extends React.Component {\n\n  render() {\n    let now = new Date()\n    let wasDate = new Date(\"Thu Jul 18 2013 15:48:59 GMT+0400\")\n    return (\n      \u003cdiv\u003e\n        \u003cp\u003e\u003cRelativeTime value={1492630940000} titleFormat=\"YYYY/MM/DD HH:mm\" /\u003e\u003c/p\u003e\n        \u003cp\u003e\u003cRelativeTime value=\"1970-01-01T00:00:00Z\" titleformat=\"iso8601\" /\u003e\u003c/p\u003e\n        \u003cp\u003e\u003cRelativeTime value={new Date(2017, 3, 19, 22, 33, 44, 666)} /\u003e\u003c/p\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n```\n\n\u0026nbsp;\n\n## Reference\n### Attribute `value`\nThe input date and time, which will be displayed in relative terms to the present date and time.\n\nSupported types:\n* *Date* object   \n  `new Date(2017, 3, 19, 22, 33, 44, 666)`\n\n* *number* - UNIX timestamp in milliseconds   \n  `1492630940000`\n\n* *string* - ISO-8601 date string   \n  `1970-01-01T00:00:00Z`\n\n### Attribute `titleFormat`\nThe specifier for the date and time format to be shown in the `title` attribute.    \nDefault: `iso8601`.\n\nSupported formats:\n* `iso8601` - ISO-8601 date string\n* *Custom string placeholders*.   \n  Replaces with numbered date/time. Text like \"Sunday\", \"Mon\", etc. are not supported.   \n  Ex: `YYYY/MM/DD HH:mm`    \n\nSupported number placeholders:\n```\nM = month\nD = date\nH = hour\nm = minute\ns = second\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faharshac%2Freact-relative-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faharshac%2Freact-relative-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faharshac%2Freact-relative-time/lists"}