# @mangar2/time

> time helper functions

Latest version **1.1.3** (published 2020-12-10) · LGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @mangar2/time
pnpm add @mangar2/time
yarn add @mangar2/time
bun add @mangar2/time
```

## 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.1.3 |
| Published | 2020-12-10 |
| First published | 2020-02-24 |
| Weekly downloads | 0 |
| License | LGPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Volker Böhm |
| Maintainers | mangar2 |
| Keywords | topic, pattern, map |

## Links

- npm: https://www.npmjs.com/package/@mangar2/time
- Repository: https://github.com/Mangar2/yaha/tree/master/node_modules/@mangar2/time
- Homepage: https://github.com/Mangar2/yaha.git
- npm.io page: https://npm.io/package/@mangar2/time

## Dependencies (1)

- [@mangar2/types](https://npm.io/package/@mangar2/types.md) latest

## Recent versions

- 1.1.3 (latest) — 2020-12-10
- 1.1.2 — 2020-03-14
- 1.1.1 — 2020-03-14
- 1.1.0 — 2020-03-14
- 1.0.0 — 2020-02-24

## README

<!-- This file is generated by jsmddoc version 0.1 -->

# Abstract

## Contents

- [Meta](#Meta)
- [Global Functions](#Global-functions)
  - [dateToTimeOfDayInSeconds](#dateToTimeOfDayInSeconds)
  - [isTimeOfDayString](#isTimeOfDayString)
  - [stringToSeconds](#stringToSeconds)
  - [timeOfDayStringToDate](#timeOfDayStringToDate)

## Meta

## Global functions

### dateToTimeOfDayInSeconds

`dateToTimeOfDayInSeconds (date) => {number}`

Gets the seconds since midnight of a date .

#### dateToTimeOfDayInSeconds Parameters

| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| `date` | `Date` | date to concider | |

#### dateToTimeOfDayInSeconds returns

| Type | Description |
| ---- | ----------- |
| `number` | amount of seconds passed since midnight |

### isTimeOfDayString

`isTimeOfDayString (timeString) => {boolean}`

Checks , if a string is a time of day string ( HH : MM or HH : MM : SS )

#### isTimeOfDayString Parameters

| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| `timeString` | `string` | delta time | |

#### isTimeOfDayString returns

| Type | Description |
| ---- | ----------- |
| `boolean` | true , if the string is a time of day string |

### stringToSeconds

`stringToSeconds (timeString) => {number}`

Converts a time string in format HH : MM or HH : MM : SS or MMM to seconds

#### stringToSeconds Parameters

| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| `timeString` | `string` | delta time | |

#### stringToSeconds throws

| Type | Description |
| ---- | ----------- |
| `Error` | on false date format |

#### stringToSeconds returns

| Type | Description |
| ---- | ----------- |
| `number` | time string in seconds |

### timeOfDayStringToDate

`timeOfDayStringToDate (timeString) => {Date}`

Converts a time string in format HH : MM or HH : MM : SS or MMM to a date ( today , same time of day )

#### timeOfDayStringToDate Parameters

| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| `timeString` | `string` | time of day | |

#### timeOfDayStringToDate throws

| Type | Description |
| ---- | ----------- |
| `Error` | on false time format |

#### timeOfDayStringToDate returns

| Type | Description |
| ---- | ----------- |
| `Date` | today , hours , minutes , seconds set to the time of day string |

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