https://github.com/nathanhoad/react-timestamp
A React component for displaying a UTC datetime in the local timezone
https://github.com/nathanhoad/react-timestamp
datetime react timestamp
Last synced: 5 months ago
JSON representation
A React component for displaying a UTC datetime in the local timezone
- Host: GitHub
- URL: https://github.com/nathanhoad/react-timestamp
- Owner: nathanhoad
- License: mit
- Created: 2015-12-16T02:06:39.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-16T06:18:37.000Z (about 3 years ago)
- Last Synced: 2025-08-09T14:50:54.630Z (5 months ago)
- Topics: datetime, react, timestamp
- Language: TypeScript
- Size: 404 KB
- Stars: 50
- Watchers: 2
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# React Timestamp
Render a nice looking time.
## Usage
If you only provide a date then it will just format it nicely:
```jsx
// 26 Mar 2018, 10:30am
```
If you enable `relative` then you'll get something like:
```jsx
// 4 hours ago
// in 4 hours
// 4 hours
// 2 years
// 1 minute ago, 2 minutes ago, 3 minutes ago
```
Other options are set by passing an `options` prop:
```jsx
// Tuesday, 26 Mar 2018, 16:30
```
## Authors
- Nathan Hoad - [nathan@nathanhoad.net](mailto:nathan@nathanhoad.net)