Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darkintaqt/react-timestamps
https://github.com/darkintaqt/react-timestamps
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/darkintaqt/react-timestamps
- Owner: DarkIntaqt
- License: mit
- Created: 2022-08-05T11:54:02.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-06T15:07:37.000Z (over 2 years ago)
- Last Synced: 2024-10-31T23:42:09.298Z (3 months ago)
- Language: JavaScript
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-timestamps
This is a lightweight JS Module converting any unix timestamp (seconds or milliseconds) or a date string into a beautified string.
```
npm install DarkIntaqt/react-timestamps
```You can use it as the following:
```js
import Timestamp from "react-timestamps"export default function App() {
return
}
```
The **date** parameter is required, the type parameter is optional, default is "relative".
| Different type | type | Result |
| ------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| relative (default) | string | e.g.: 5 hours ago, in 5 hours |
| static | string | 8/23/2022, 12:01:24AM |
| { } | object | any valid .toLocaleTimeString() options object, see more [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString#using_options). |