Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-01-12T06:29:46.000Z (almost 2 years ago)
- Last Synced: 2024-05-01T21:03:01.439Z (8 months ago)
- Topics: date, library, micro, time
- Language: JavaScript
- Homepage:
- Size: 278 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timeAgo [![CircleCI Status](https://circleci.com/gh/chute/timeago.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/chute/timeago) [![npm version](https://badge.fury.io/js/%40chute%2Ftimeago.svg)](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