@chute/timeago

A byte-sized library for displaying a human-readable relative time.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@chute/timeago
Minified + gzip package size for @chute/timeago in KB

Readme

timeAgo CircleCI Status

A byte-sized library for displaying a human-readable relative time. Produces the same output as Moment's fromNow and toNow except it comes in a much smaller package.

Installation

# NPM
npm install @chute/timeago --save

# Yarn
yarn add @chute/timeago

Usage

// Common.js & AMD
var timeAgo = require('@chute/timeago')

// ES modules
import timeAgo from '@chute/timeago'

// Browser Global
// <script src="https://unpkg.com/@chute/timeago">

// 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

# 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

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.