# readable-timestamp

> Generates a human readable timestamp.

Latest version **0.2.0** (published 2016-04-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install readable-timestamp
pnpm add readable-timestamp
yarn add readable-timestamp
bun add readable-timestamp
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2016-04-15 |
| First published | 2016-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Eneko |
| Maintainers | eneko89 |
| Keywords | time, ago, elapsed, timestamp, readable |

## Links

- npm: https://www.npmjs.com/package/readable-timestamp
- Repository: https://github.com/eneko89/readable-timestamp
- Homepage: https://github.com/eneko89/readable-timestamp#readme
- Issues: https://github.com/eneko89/readable-timestamp/issues
- npm.io page: https://npm.io/package/readable-timestamp

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2016-04-15
- 0.1.1 — 2016-04-05
- 0.1.0 — 2016-04-05

## README

readable-timestamp
==================

Generates a human readable timestamp that tells how many time has elapsed since
a given date until now. If more than 30 days have elapsed, generates a short date
string: day + abbreviated month + year (last one only if the given date it's not
in the current year).

Elapsed time | Output example
------------ | --------------
Less than a minute | Just now
One minute | A minute ago
Between 1 - 60 minutes | 7 minutes ago
One hour | An hour ago
Between 1 - 24 hours | 13 hours ago
One day | A day ago
Between 1 - 30 days | 4 days ago
More than a month, but in the current year | 23 Feb
More than a month, but in another year | 9 Dec 2015


Usage
-----

Works both required as CommonsJS module in node or in the browser.

As a CommonsJS module it exports a function, and in a browser environment
declares 'readableTime()' function in the global scope.

```javascript

var readableTime = require('readable-timestamp');

var now = new Date();

// It will log 'Just now'.
console.log(readableTime(now));

```

You can also generate absolute timestamps providing an options.format as the
second parameter. Accepts 'absolute', 'absolute-full' and 'absolute-short'.

```javascript

var readableTime = require('readable-timestamp');

// At time of writing this, it was 15 April 2016.
var now = new Date();

// It will log '15 Apr', but if 'now' contained a date from 15 April 2015,
// it would log '15 Apr 2015', because it's form the past year. Using the
// 'absolute-full' format will always add the year and with 'absolute-short'
// it won't never do it.
console.log(readableTime(now, { format: 'absolute' }));

```

---
_Source: https://npm.io/package/readable-timestamp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
