@barchart/common-js
Advanced tools
Comparing version 3.0.18 to 3.0.19
@@ -103,2 +103,35 @@ const assert = require('./assert'), | ||
/** | ||
* Indicates if another {@link Day} occurs before the current instance. | ||
* | ||
* @public | ||
* @param {Day} other | ||
* @returns {boolean} | ||
*/ | ||
getIsBefore(other) { | ||
return Day.compareDays(this, other) < 0; | ||
} | ||
/** | ||
* Indicates if another {@link Day} occurs after the current instance. | ||
* | ||
* @public | ||
* @param {Day} other | ||
* @returns {boolean} | ||
*/ | ||
getIsAfter(other) { | ||
return Day.compareDays(this, other) > 0; | ||
} | ||
/** | ||
* Indicates if another {@link Day} occurs after the current instance. | ||
* | ||
* @public | ||
* @param {Day} other | ||
* @returns {boolean} | ||
*/ | ||
getIsEqual(other) { | ||
return Day.compareDays(this, other) === 0; | ||
} | ||
/** | ||
* The year. | ||
@@ -105,0 +138,0 @@ * |
const assert = require('./assert'), | ||
Enum = require('./Enum'), | ||
is = require('./is'), | ||
timezone = require('./timezone'); | ||
@@ -5,0 +4,0 @@ |
{ | ||
"name": "@barchart/common-js", | ||
"version": "3.0.18", | ||
"version": "3.0.19", | ||
"description": "Library of common javascript utilities", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -239,1 +239,93 @@ var Day = require('./../../../lang/Day'); | ||
}); | ||
describe('When "1900-01-01 is parsed as a Day', function() { | ||
'use strict'; | ||
var day; | ||
beforeEach(function() { | ||
day = Day.parse('1900-01-01'); | ||
}); | ||
it('the year should be 1900', function() { | ||
expect(day.year).toEqual(1900); | ||
}); | ||
it('the month should be 1', function() { | ||
expect(day.month).toEqual(1); | ||
}); | ||
it('the day should be 1', function() { | ||
expect(day.day).toEqual(1); | ||
}); | ||
describe('and 41635 days are added', function() { | ||
var future; | ||
beforeEach(function() { | ||
future = day.addDays(41635); | ||
}); | ||
it('the year should be 2013', function() { | ||
expect(future.year).toEqual(2013); | ||
}); | ||
it('the month should be 12', function() { | ||
expect(future.month).toEqual(12); | ||
}); | ||
it('the day should be 29', function() { | ||
expect(future.day).toEqual(29); | ||
}); | ||
}); | ||
}); | ||
describe('When comparing days', function() { | ||
it('The day "2017-07-18" should be before "2017-07-19"', function() { | ||
expect(Day.parse('2017-07-18').getIsBefore(Day.parse('2017-07-19'))).toEqual(true); | ||
}); | ||
it('The day "2017-07-18" should be before "2017-08-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsBefore(Day.parse('2017-08-18'))).toEqual(true); | ||
}); | ||
it('The day "2017-07-18" should be before "2018-07-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsBefore(Day.parse('2018-07-18'))).toEqual(true); | ||
}); | ||
it('The day "2017-07-18" should not be after "2017-07-19"', function() { | ||
expect(Day.parse('2017-07-18').getIsAfter(Day.parse('2017-07-19'))).toEqual(false); | ||
}); | ||
it('The day "2017-07-18" should not be after "2017-08-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsAfter(Day.parse('2017-08-18'))).toEqual(false); | ||
}); | ||
it('The day "2017-07-18" should bit be afte "2018-07-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsAfter(Day.parse('2018-07-18'))).toEqual(false); | ||
}); | ||
it('The day "2017-07-18" should not be before "2017-07-17"', function() { | ||
expect(Day.parse('2017-07-18').getIsBefore(Day.parse('2017-07-17'))).toEqual(false); | ||
}); | ||
it('The day "2017-07-18" should not be before "2017-06-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsBefore(Day.parse('2017-06-18'))).toEqual(false); | ||
}); | ||
it('The day "2017-07-18" should not be before "2016-07-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsBefore(Day.parse('2016-07-18'))).toEqual(false); | ||
}); | ||
it('The day "2017-07-18" should be after "2017-07-17"', function() { | ||
expect(Day.parse('2017-07-18').getIsAfter(Day.parse('2017-07-17'))).toEqual(true); | ||
}); | ||
it('The day "2017-07-18" should be after "2017-06-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsAfter(Day.parse('2017-06-18'))).toEqual(true); | ||
}); | ||
it('The day "2017-07-18" should be after "2016-07-18"', function() { | ||
expect(Day.parse('2017-07-18').getIsAfter(Day.parse('2016-07-18'))).toEqual(true); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
2618886
58302