/unexpected-date

Unexpected.js plugin for date/time assertions

Primary LanguageJavaScriptMIT LicenseMIT

Unexpected-date

NPM version Build Status Coverage Status Dependency Status

Add support for useful date/time assertions to Unexpected.js

Table of Contents

Why

You can use this module if you are looking for

  • Assertions on native Date objects
  • Dependency free light-weight module
  • Browser support

Installation

You will need unexpected@10.32.0 or above to use this module.

Node.js

$ npm install --save-dev unexpected-date
$ yarn add --dev unexpected-date
var expect = require('unexpected').clone();
expect.use(require('unexpected-date'));

Browser

Include unexpected-date.min.js from root directory of this repository.

<script src="unexpected.js"></script>
<script src="unexpected-date.min.js"></script>

This will expose the expect function under the following namespace:

var expect = weknowhow.expect.clone();
expect.use(unexpectedDate);

Documentation

You can find more detailed docs here

Assertions Available

  • to be after
  • to be before
  • to be [inclusively] between
  • to be same or after
  • to be same or before
  • to equal date
  • to equal time

Notes

This module is inspired from Unexpected Moment assertions.