# time-factory

> Time utility package.

Latest version **1.1.1** (published 2018-11-15) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2018-11-15 |
| First published | 2018-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Keyser Söze |
| Maintainers | keyser_soze |
| Keywords | time, utility, package |

## Links

- npm: https://www.npmjs.com/package/time-factory
- Repository: https://github.com/pasdechancee/time-factory
- Homepage: https://github.com/pasdechancee/time-factory#readme
- Issues: https://github.com/pasdechancee/time-factory/issues
- npm.io page: https://npm.io/package/time-factory

## 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.1.1 (latest) — 2018-11-15
- 1.1.0 — 2018-11-13
- 1.0.4 — 2018-11-10
- 1.0.3 — 2018-11-10
- 1.0.2 — 2018-11-10
- 1.0.1 — 2018-11-10
- 1.0.0 — 2018-11-09

## README

# Time

![NPM version](https://img.shields.io/npm/v/time-factory.svg?style=flat-square)
![Github issues](https://img.shields.io/github/issues/pasdechancee/time-factory.svg?style=flat-square)
![NPM downloads](https://img.shields.io/npm/dt/time-factory.svg)
![Github stars](https://img.shields.io/github/stars/pasdechancee/time-factory.svg?style=flat-square)

### [Install](#install) · [Usage](#usage) · [API](#api) · [Contributing](#contributing)

## Setup

### Install

Install time factory in your project as an NPM dependency :

```shell
npm install time-factory
```

### Usage

```js
const Time = require('time-factory');

console.log(Time.milliseconds());
// => 4017501183677
```

## API

<a name="Time"></a>

## Time
Time utility package mostly based off of built-in methods
and objects to make the time-related functions easier to use.
This returns a unique instance of the Time factory function.

**Kind**: global class  

* [Time](#Time)
    * [.seconds()](#Time+seconds)
    * [.milliseconds()](#Time+milliseconds)
    * [.precision()](#Time+precision)
    * [.ts_s_to_ms()](#Time+ts_s_to_ms)
    * [.ts_ms_to_s()](#Time+ts_ms_to_s)
    * [.ts_s_to_ISO()](#Time+ts_s_to_ISO)
    * [.ts_ms_to_ISO()](#Time+ts_ms_to_ISO)

<a name="Time+seconds"></a>

### time.seconds()
Returns the number of seconds elapsed
since January 1, 1970 00:00:00 UTC.

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.seconds()
// =>
1541795947
```
<a name="Time+milliseconds"></a>

### time.milliseconds()
Returns the number of milliseconds elapsed
since January 1, 1970 00:00:00 UTC.

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.milliseconds()
// =>
1541795947853
```
<a name="Time+precision"></a>

### time.precision()
Returns a high-resolution time in nanoseconds.
Meant to compute the execution time.
Relies on [process.hrtime](https://nodejs.org/api/process.html#process_process_hrtime_time).

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.precision()
// =>
4017501183677
```
<a name="Time+ts_s_to_ms"></a>

### time.ts\_s\_to\_ms()
Returns a timestamp in milliseconds from
a timestamp in seconds.

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.ts_s_to_ms(1541795948)
// =>
1541795948000
```
<a name="Time+ts_ms_to_s"></a>

### time.ts\_ms\_to\_s()
Returns a timestamp in seconds from
a timestamp in milliseconds.

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.ts_ms_to_s(1541795947853)
// =>
1541795947
```
<a name="Time+ts_s_to_ISO"></a>

### time.ts\_s\_to\_ISO()
Returns a date as a string in ISO format
from a timestamp in seconds.

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.ts_s_to_ISO(1541795947)
// =>
'2018-11-09T20:39:07.000Z'
```
<a name="Time+ts_ms_to_ISO"></a>

### time.ts\_ms\_to\_ISO()
Returns a date as a string in ISO format
from a timestamp in milliseconds.

**Kind**: instance method of [<code>Time</code>](#Time)  
**Example**  
```js
Time.ts_ms_to_ISO(1541795947853)
// =>
'2018-11-09T20:39:07.853Z'
```

## Contributing

Please read the [CONTRIBUTING](https://github.com/pasdechancee/time-factory/blob/master/CONTRIBUTING.md)
document before making changes that you would like adopted in the code.

* * *

&copy; [MIT license](https://github.com/pasdechancee/time-factory/blob/master/LICENSE)
Contact: <pasdechancee.keyser-soze@protonmail.com>

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