# countdown.to

> A small countdown timer

Latest version **0.1.6** (published 2016-07-12) · 0 weekly downloads

## Install

```sh
npm install countdown.to
pnpm add countdown.to
yarn add countdown.to
bun add countdown.to
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2016-07-12 |
| First published | 2015-10-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Charlie Hawker |
| Maintainers | toomanyredirects |
| Keywords | countdown, timer, count |

## Links

- npm: https://www.npmjs.com/package/countdown.to
- Repository: https://github.com/CharlieHawker/CountdownTo.js
- Homepage: https://github.com/CharlieHawker/CountdownTo.js#readme
- Issues: https://github.com/CharlieHawker/CountdownTo.js/issues
- npm.io page: https://npm.io/package/countdown.to

## Recent versions

- 0.1.6 (latest) — 2016-07-12
- 0.1.3 — 2015-11-11
- 0.1.2 — 2015-10-27
- 0.1.0 — 2015-10-27

## README

[![Build Status](https://travis-ci.org/CharlieHawker/CountdownTo.js.svg?branch=master)](https://travis-ci.org/CharlieHawker/CountdownTo.js) [![npm version](https://badge.fury.io/js/countdown.to.svg)](https://badge.fury.io/js/countdown.to)

# CountdownTo.js

This is a simple vanilla javascript-based countdown timer.

*N.B.* Not designed for anything other than simple displays, as it makes assumptions (365 days / year, 30 days / month, no leap year handling...)!

## Installation

**Node**
```
npm install countdown.to --save
```

**Bower**
```
bower install countdown.to --save
```


## Usage

*If* using node.js, require the module
```
var CountdownTo = require('countdown.to');
```

To create a new countdown timer targeting a specific date:
```
// Create a new timer
var timer = new CountdownTo('2015-12-25 00:00:00');
```

To update the display when the time remaining is recalculated:
```
var timer = new CountdownTo('2015-12-25 00:00:00', { onCalculateRemainingTime: function() {
  var c = this;
  document.getElementById('myTimerDiv').innerHTML = c.timeRemainingForDisplay();
});
```

Other API & options described below.


## API & Options

### `onCountdownBegin`
Callback function called when countdown timer initialises.

### `onCountdownEnd`
Callback function called when countdown timer reaches 0.

### `onCalculateRemainingTime`
Callback function called when the remaining time is recalculated.

### `updateInterval`
Interval in milliseconds at which remaining time is recalculated (default: 500)

### `indexTimeUnitNameMap`
The display units for each time unit that is calculated (default: `['years', 'months', 'days', 'hours', 'minutes', 'seconds']`)

## Tests

`npm test`

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