# @js-random/date

> A simple and lightweight date randomizer for JavaScript (TypeScript friendly)

Latest version **0.3.5** (published 2019-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @js-random/date
pnpm add @js-random/date
yarn add @js-random/date
bun add @js-random/date
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.5 |
| Published | 2019-03-28 |
| First published | 2019-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Raiondesu |
| Maintainers | raiondesu |
| Keywords | js, ts, typescript, javascript, string, number, boolean, array, random, simple, lightweight, es5, JSON, definetly-typed, modular, monorepo, micropackage |

## Links

- npm: https://www.npmjs.com/package/@js-random/date
- Repository: https://github.com/Raiondesu/js-random
- Homepage: https://github.com/Raiondesu/js-random/tree/master/packages/date#readme
- Issues: https://github.com/Raiondesu/js-random/issues
- npm.io page: https://npm.io/package/@js-random/date

## Dependencies (1)

- [@js-random/number](https://npm.io/package/@js-random/number.md) ^0.3.5

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.3.5 (latest) — 2019-03-28
- 0.3.3 — 2019-03-26
- 0.3.2 — 2019-03-26
- 0.3.1 — 2019-03-26
- 0.3.0 — 2019-03-26
- 0.2.2 — 2019-03-26
- 0.2.0 — 2019-03-26
- 0.1.1 — 2019-03-25
- 0.1.0 — 2019-03-25
- 0.0.9 — 2019-03-25
- 0.0.8 — 2019-03-25
- 0.0.6 — 2019-03-25
- 0.0.5 — 2019-03-25
- 0.0.4 — 2019-03-25

## README

# `@js-random/date`

> A simple and lightweight date randomizer for JavaScript (TypeScript friendly)

## Installation

```
npm i -S @js-random/date
```

## Usage

**commonjs**:
```js
var randomDate = require('@js-random/date').default;
```

**TS/ES6+**:
```ts
import randomDate from '@js-random/date';
```

**`<script> tag`**:
```html
<script src="https://unpkg.com/@js-random/date"></script>
```

```js
var date = randomDate(); // A random date, basically
var from2010To2012 = randomDate({ from: new Date(2010, 1, 1), to: new Date(2010, 1, 1) }); // random date from Jan 1 2010 to Jan 1 2012
```


## Global version

This package also has a global version, which introduces side-effects by exposing the api as `Date.random()` function.

### Import

**commonjs**:
```js
require('@js-random/date/lib/global');
```

**ES6+**:
```ts
import '@js-random/date/module/global';
```

**TS**:
```ts
import '@js-random/date/module/global';
```

**`<script> tag`**
```html
<script src="https://unpkg.com/@js-random/date/unpkg/global"></script>
```

### Usage

```js
var date = Date.random(); // A random date, basically
var from2010To2012 = Date.random({ from: new Date(2010, 1, 1), to: new Date(2010, 1, 1) }); // random date from Jan 1 2010 to Jan 1 2012
```

## Other packages

Please, have a look at other packages from `@js-random` series:

- `@js-random/all` - all the randomizers in one package - [GitHub repo](https://github.com/Raiondesu/js-random/tree/master/packages/all#readme), [NPM](https://www.npmjs.com/@js-random/string)
- `@js-random/number` [GitHub repo](https://github.com/Raiondesu/js-random/tree/master/packages/number#readme), [NPM](https://www.npmjs.com/@js-random/number)
- `@js-random/boolean` [GitHub repo](https://github.com/Raiondesu/js-random/tree/master/packages/boolean#readme), [NPM](https://www.npmjs.com/@js-random/boolean)
- `@js-random/string` [GitHub repo](https://github.com/Raiondesu/js-random/tree/master/packages/string#readme), [NPM](https://www.npmjs.com/@js-random/string)

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