{"repo":"catamphetamine/react-time-ago","free":true,"listed":false,"github":"https://github.com/catamphetamine/react-time-ago","clone":"git clone https://github.com/catamphetamine/react-time-ago.git","description":"Localized relative date/time formatting in React","language":"JavaScript","stars":101,"topics":["react","time"],"license":"MIT","category":"ui-components","readme_excerpt":"react-time-ago Formats a Date into a string like \"1 day ago\" . In any language. just now 45s 5m 15 minutes ago 3 hours ago 2 days ago in 4 months in 5 years … Automatically refreshes itself. See Demo Install Alternatively, one could include it on a web page directly via a tag. Use To begin, decide on the set of languages that your application will be translated into. For now, let's assume that it's gonna be just English. Then, for each of those languages, import the language data: Now you're ready to render a component for any of those languages. To change the output style, pass a timeStyle property: see the list of available formatting styles. The label will automatically refresh itself. Hook If you prefer using a React Hook rather than a React Component, the parameters for it are the same as the props for the React component, excluding: tooltip: boolean component: React.Component wrapperComponent: React.Component wrapperProps: object Example: The hook returns an object with properties: date: Date — Same as the date input parameter. If the input parameter was a timestamp ( number ) then it gets converted to a Date . formattedDate: string — Formatted date . Example: \"5 min ago\" . verboseDate: string — Formatted date (verbose variant). Example: \"Thursday, December 20, 2012, 7:00:00 AM GMT+4\" . React Native By default, this component renders a HTML element. When using this component in React Native, a developer should pass a custom component property that will be used instead o","default_branch":null,"files":null,"tree":[],"storefront":"/r/catamphetamine","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/catamphetamine/react-time-ago/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}