compare-dates
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,5 +5,5 @@ 'use strict'; | ||
function isValidDate (input) { | ||
var isValidDate = function (input) { | ||
return input instanceof Date && !isNaN(input.getTime()); | ||
} | ||
}; | ||
@@ -47,2 +47,7 @@ const aliases = {}; | ||
function setDayOfWeek(date, input) { | ||
const day = date.getDay(); | ||
date.setDate(date.getDate() + input - day); | ||
} | ||
function Duration(duration) { | ||
@@ -133,2 +138,3 @@ var years = duration.year || 0, | ||
/* falls through */ | ||
case 'week': | ||
case 'day': | ||
@@ -148,2 +154,7 @@ case 'date': | ||
// weeks are a special case | ||
if (units === 'week') { | ||
setDayOfWeek(modified, 1); | ||
} | ||
// quarters are also special | ||
@@ -327,2 +338,2 @@ if (units === 'quarter') { | ||
exports.endOf = endOf; | ||
exports.diff = diff; | ||
exports.diff = diff; |
@@ -1,4 +0,4 @@ | ||
function isValidDate (input) { | ||
var isValidDate = function (input) { | ||
return input instanceof Date && !isNaN(input.getTime()); | ||
} | ||
}; | ||
@@ -42,2 +42,7 @@ const aliases = {}; | ||
function setDayOfWeek(date, input) { | ||
const day = date.getDay(); | ||
date.setDate(date.getDate() + input - day); | ||
} | ||
function Duration(duration) { | ||
@@ -128,2 +133,3 @@ var years = duration.year || 0, | ||
/* falls through */ | ||
case 'week': | ||
case 'day': | ||
@@ -143,2 +149,7 @@ case 'date': | ||
// weeks are a special case | ||
if (units === 'week') { | ||
setDayOfWeek(modified, 1); | ||
} | ||
// quarters are also special | ||
@@ -310,2 +321,2 @@ if (units === 'quarter') { | ||
export { min, max, isAfter, isBefore, isBetween, isSame, isSameOrAfter, isSameOrBefore, add, subtract, startOf, endOf, diff }; | ||
export { min, max, isAfter, isBefore, isBetween, isSame, isSameOrAfter, isSameOrBefore, add, subtract, startOf, endOf, diff }; |
@@ -5,3 +5,3 @@ { | ||
"repository": "https://github.com/guardian/compare-dates", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"license": "Apache-2.0", | ||
@@ -20,12 +20,12 @@ "main": "dist/compare.cjs.js", | ||
"devDependencies": { | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.10.3", | ||
"babel-plugin-transform-es2015-parameters": "^6.9.0", | ||
"babel-plugin-transform-es2015-spread": "^6.8.0", | ||
"babel-register": "^6.9.0", | ||
"eslint": "^2.13.1", | ||
"rollup": "^0.32.2", | ||
"rollup-plugin-babel": "^2.6.0", | ||
"rollup-plugin-commonjs": "^3.0.0", | ||
"rollup-plugin-node-resolve": "^1.5.0", | ||
"tap": "^5.7.2" | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", | ||
"babel-plugin-transform-es2015-parameters": "^6.24.1", | ||
"babel-plugin-transform-es2015-spread": "^6.22.0", | ||
"babel-register": "^6.24.1", | ||
"eslint": "^4.2.0", | ||
"rollup": "^0.45.2", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"rollup-plugin-commonjs": "^8.0.2", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"tap": "^10.7.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
23055
5
564
1
50