Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-datetime

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-datetime - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

8

chai-datetime.js

@@ -40,8 +40,12 @@ (function(plugin){

var dateWithoutTime = function(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
chai.datetime.beforeDate = function(actual, expected) {
return actual.getUTCFullYear() < expected.getUTCFullYear() || actual.getUTCMonth() < expected.getUTCMonth() || actual.getUTCDate() < expected.getUTCDate();
return chai.datetime.beforeTime(dateWithoutTime(actual), dateWithoutTime(expected));
};
chai.datetime.afterDate = function(actual, expected) {
return actual.getUTCFullYear() > expected.getUTCFullYear() || actual.getUTCMonth() > expected.getUTCMonth() || actual.getUTCDate() > expected.getUTCDate();
return chai.datetime.afterTime(dateWithoutTime(actual), dateWithoutTime(expected));
};

@@ -48,0 +52,0 @@

{
"name": "chai-datetime",
"version": "1.3.0",
"version": "1.3.1",
"keywords": ["chai", "testing", "jasmine"],

@@ -5,0 +5,0 @@ "description": "date / time comparison matchers for chai",

@@ -63,2 +63,8 @@ (function(test){

});
it('should not be affected by time zones', function() {
var midnight = new Date(2014, 0, 1, 0);
var endOfDay = new Date(2014, 0, 1, 23);
chai.datetime.afterDate(endOfDay, midnight).should.be.false;
});
});

@@ -68,4 +74,4 @@

beforeEach(function() {
this.actual = new Date(2013, 3, 29);
this.expected = new Date(2013, 3, 30);
this.actual = new Date(2014, 0, 31);
this.expected = new Date(2014, 11, 1);
});

@@ -112,2 +118,8 @@

});
it('should not be affected by time zones', function() {
var midnight = new Date(2014, 0, 1, 0);
var endOfDay = new Date(2014, 0, 1, 23);
chai.datetime.beforeDate(midnight, endOfDay).should.be.false;
});
});

@@ -121,3 +133,3 @@

it('returns false', function() {
it('returns true', function() {
chai.datetime.beforeDate(this.actual, this.expected).should.be.eq(true)

@@ -129,4 +141,4 @@ });

beforeEach(function() {
this.actual = new Date(2013, 3, 30);
this.expected = new Date(2013, 3, 29);
this.actual = new Date(2048, 0, 1);
this.expected = new Date(2014, 11, 31);
});

@@ -133,0 +145,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc