https://github.com/mareksuscak/timeago
📅 A byte-sized library for displaying a human-readable relative time.
https://github.com/mareksuscak/timeago
date library micro time
Last synced: 3 months ago
JSON representation
📅 A byte-sized library for displaying a human-readable relative time.
- Host: GitHub
- URL: https://github.com/mareksuscak/timeago
- Owner: mareksuscak
- License: mit
- Created: 2018-04-14T22:47:26.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2023-01-12T06:29:46.000Z (over 3 years ago)
- Last Synced: 2025-03-21T15:16:11.022Z (over 1 year ago)
- Topics: date, library, micro, time
- Language: JavaScript
- Homepage:
- Size: 278 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timeAgo [](https://circleci.com/gh/chute/timeago) [](https://badge.fury.io/js/%40chute%2Ftimeago)
A byte-sized library for displaying a human-readable relative time. Produces the same output as [Moment's](http://momentjs.com/) `fromNow` and `toNow` except it comes in a much smaller package.
## Installation
```sh
# NPM
npm install @chute/timeago --save
# Yarn
yarn add @chute/timeago
```
## Usage
```js
// Common.js & AMD
var timeAgo = require('@chute/timeago')
// ES modules
import timeAgo from '@chute/timeago'
// Browser Global
//
// Usage
timeAgo() // uses current date
timeAgo(new Date()) // explicitly passing current date
timeAgo(1491953789490) // explicitly passing a unix timestamp
timeAgo('2017-04-11T23:36:46Z') // explicitly passing an ISO8601 date string
```
## Tests
```sh
# CI server
npm test
# Development
npm test -- --watch
```
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style.
Add unit tests for any new or changed functionality. Lint and test your code.
## Release History
* 1.0.0 Initial release