Unexpected-date

Unexpected date :)

This module extends the Unexpected assertion library to support date/time assertions.

var dateA = new Date(Date.UTC(2010, 10, 11, 0, 0, 0));
var dateB = new Date(Date.UTC(2010, 10, 10, 0, 0, 0));
expect(dateA, 'to be same or before', dateB);
expected new Date('Thu, 11 Nov 2010 00:00:00 GMT')
to be same or before new Date('Wed, 10 Nov 2010 00:00:00 GMT')

NPM version Build Status Coverage Status Dependency Status

How to use

Node

Install it with NPM or add it to your package.json:

$ npm install unexpected unexpected-date

Then:

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);

RequireJS

Include the library with RequireJS the following way:

define(['unexpected', 'unexpectedDate'], funtion (unexpected, unexpectedDate) {
   var expect = unexpected.clone();
   expect.use(unexpectedDate);
   // Your code
});

MIT License

The MIT License (MIT)

Copyright (c) 2017 Sushant Dhiman

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Fork me on GitHub