# human-interval

> Human readable time measurements

Latest version **2.0.1** (published 2021-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install human-interval
pnpm add human-interval
yarn add human-interval
bun add human-interval
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2021-01-16 |
| First published | 2013-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 465 |
| Author | Ryan Schmukler |
| Maintainers | rschmukler, simison |
| Keywords | interval, time, date |

## Links

- npm: https://www.npmjs.com/package/human-interval
- Repository: https://github.com/agenda/human-interval
- Homepage: https://github.com/agenda/human-interval#readme
- Issues: https://github.com/agenda/human-interval/issues
- npm.io page: https://npm.io/package/human-interval

## Dependencies (1)

- [numbered](https://npm.io/package/numbered.md) ^1.1.0

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

- 2.0.1 (latest) — 2021-01-16
- 2.0.0 — 2020-10-16
- 1.0.0 — 2019-11-24
- 0.1.6 — 2016-05-11
- 0.1.5 — 2015-07-30
- 0.1.4 — 2014-04-06
- 0.1.3 — 2014-01-04
- 0.1.2 — 2014-01-03
- 0.1.1 — 2013-10-28
- 0.1.0 — 2013-10-25

## README

# Human Interval
Human-readable interval parser for Javascript.

Converts words written in English to numbers by using [node-numbered](https://github.com/blakeembrey/node-numbered).

Originally inspired by [matthewmueller/date](http://github.com/matthewmueller/date).

## Uses

Human Interval is used by job scheduling libraries such as [Agenda](https://github.com/Agenda/agenda#readme) and [Bree](https://jobscheduler.net). They are a job schedulers for Node.js with cron expression syntax, human-friendly times, Dates, and more!

## Example usage

```js
const humanInterval = require('human-interval');

setTimeout(() => {
  // Do something!
}, humanInterval('three minutes'));
```

## More sophisticated examples

Human Interval understands all of the following examples:

```js
humanInterval('minute');
humanInterval('one minute');
humanInterval('1.5 minutes');
humanInterval('3 days and 4 hours');
humanInterval('3 days, 4 hours and 36 seconds');
humanInterval('4 months, 3 days, 5 hours and forty-five seconds');
```

## The full list

### Units

Supports the following units in the plural and singular forms:

- `seconds`
- `minutes`
- `hours`
- `days`
- `weeks`
- `months` — assumes 30 days
- `years` — assumes 365 days

### Wordy numbers

Supports numbers being written out in English words.

```js
humanInterval('five minutes');
```

### Hyphenated numbers

Supports hyphenated numbers.

```js
humanInterval('twenty-five seconds');
```

### Negative numbers

Supports negative numbers if the time starts with a `-` symbol immediately followed by a number.

```js
humanInterval('-2 minutes');
```

# License
[The MIT License](LICENSE.md)

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