chai-datetime
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26210
589