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

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 schema = Joi.object({
  from: Joi.date().required(),
  to: Joi.date().required().withinDays(10, Joi.ref('from'))
});

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

Joi.assert(input, schema)
```<commit_msg>update example with how to extend Joi with this module<commit_after>#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)

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.date().required().withinDays(10, Joi.ref('from'))
});

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

Joi.assert(input, schema)
```
{'fraction_non_alphanumeric': 0.15318539727988548, 'fraction_numerical': 0.024337866857551897, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5668844', 'n_tokens_mistral': 510, 'n_tokens_neox': 478, 'n_words': 132}