# joi-extension-date-within

> Adds within validation to enable you to specify how many days a from a value should be

Latest version **2.1.0** (published 2017-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install joi-extension-date-within
pnpm add joi-extension-date-within
yarn add joi-extension-date-within
bun add joi-extension-date-within
```

## 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 | 2.1.0 |
| Published | 2017-01-11 |
| First published | 2016-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jamie McConnell |
| Maintainers | jamiemcconnell |
| Keywords | joi, validation, extension, date, within |

## Links

- npm: https://www.npmjs.com/package/joi-extension-date-within
- Repository: https://github.com/jamiemcconnell/joi-extension-date-within
- Homepage: https://github.com/jamiemcconnell/joi-extension-date-within#readme
- Issues: https://github.com/jamiemcconnell/joi-extension-date-within/issues
- npm.io page: https://npm.io/package/joi-extension-date-within

## Dependencies (2)

- [joi](https://npm.io/package/joi.md) 10.1.0
- [hoek](https://npm.io/package/hoek.md) 4.1.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-01-11
- 2.0.0 — 2017-01-09
- 1.0.2 — 2017-01-06
- 1.0.1 — 2017-01-05
- 1.0.0 — 2016-08-31
- 0.0.3 — 2016-08-30
- 0.0.2 — 2016-08-25
- 0.0.1 — 2016-08-25

## README

#Joi Extension Within Date

[![Build Status](https://travis-ci.org/jamiemcconnell/joi-extension-date-within.svg?branch=master)](https://travis-ci.org/jamiemcconnell/joi-extension-date-within)
[![Coverage Status](https://coveralls.io/repos/github/jamiemcconnell/joi-extension-date-within/badge.svg?branch=coveralls)](https://coveralls.io/github/jamiemcconnell/joi-extension-date-within?branch=coveralls)
[![dependencies Status](https://david-dm.org/jamiemcconnell/joi-extension-date-within/status.svg)](https://david-dm.org/jamiemcconnell/joi-extension-date-within)

An extension to Joi to enable checking that a date is within a number of days of another date property.

In the below example we are confirming that `to` is within `10` days of `from`

```javascript
var Joi = require('joi').extend(require('joi-extension-date-within'));

var schema = Joi.object({
  from: Joi.date().required(),
  to: Joi.dateWithin().required().days(10, Joi.ref('from'))
});

var input = {
  from: new Date(2016,3,1),
  to: new Date(2016,3,30)
};

Joi.assert(input, schema)
```

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