# time-radians

> Convert hours/minutes/seconds to clock hand angles

Latest version **1.0.0** (published 2017-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install time-radians
pnpm add time-radians
yarn add time-radians
bun add time-radians
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-03-23 |
| First published | 2017-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Paul Salaets |
| Maintainers | psalaets |
| Keywords | time, clock, angle |

## Links

- npm: https://www.npmjs.com/package/time-radians
- Repository: https://github.com/psalaets/time-radians
- Issues: https://github.com/psalaets/time-radians/issues
- npm.io page: https://npm.io/package/time-radians

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

- 1.0.0 (latest) — 2017-03-23

## README

# time-radians

Convert hours/minutes/seconds to clock hand angles.

## Install

`$ npm install --save time-radians`

## Usage

```js
let timeRadians = require('time-radians');

let now = new Date();

let hoursAngle = timeRadians.hoursHand(now.getHours(), now.getMinutes(), now.getSeconds());
let minutesAngle = timeRadians.minutesHand(now.getMinutes(), now.getSeconds());
let secondsAngle = timeRadians.secondsHand(now.getSeconds());

// render clock
```

## API

`let timeRadians = require('time-radians');`

### timeRadians.hoursHand(hours, minutes = 0, seconds = 0)

Hours can be 12-hour or 24-hour.

Returns angle for hours hand, in radians.

### timeRadians.minutesHand(minutes, seconds = 0)

Returns angle for minutes hand, in radians.

### timeRadians.secondsHand(seconds)

Returns angle for seconds hand, in radians.

## Rendering tip

Assuming your clock's center looks like

```js
var center = {
  x: 100,
  y: 200
};
```

use this to figure out where to render clock hands

```js
function endPoint(center, length, radians) {
  return {
    x: center.x + (length * Math.cos(radians)),
    y: center.y - (length * Math.sin(radians))
  };
}
```


## License

MIT

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