Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/firstandthird/relative
Javascript relative date library
https://github.com/firstandthird/relative
Last synced: 3 days ago
JSON representation
Javascript relative date library
- Host: GitHub
- URL: https://github.com/firstandthird/relative
- Owner: firstandthird
- License: mit
- Created: 2013-05-27T17:44:16.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-04-19T17:19:50.000Z (almost 7 years ago)
- Last Synced: 2025-01-09T09:53:50.555Z (13 days ago)
- Language: JavaScript
- Size: 75.2 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Relative
Relative date library
## Installation
`npm install @firstandthird/relative`
## Usage
```javascript
import relative from '@firstandthird/relative';relative(toDate, fromDate);
// fromDate is optional, defaults to Date.now()
// returns string
```### Example return values
- Just now
- 5 minutes ago
- 1 hour ago
- 2 days ago
- 1 week ago
- 1 month ago
- if longer than 1 month, returns short date 05/27/2013