diff --git a/moment-precise-range.js b/moment-precise-range.js index 2ee611e..b3c2474 100644 --- a/moment-precise-range.js +++ b/moment-precise-range.js @@ -1,5 +1,5 @@ if (typeof moment === "undefined" && require) { - moment = require('moment'); + var moment = require('moment'); } (function(moment) { @@ -55,9 +55,9 @@ if (typeof moment === "undefined" && require) { moment.preciseDiff = function(d1, d2, returnValueObject) { var m1 = moment(d1), m2 = moment(d2), firstDateWasLater; - + m1.add(m2.utcOffset() - m1.utcOffset(), 'minutes'); // shift timezone of m1 to m2 - + if (m1.isSame(m2)) { return STRINGS.nodiff; } diff --git a/package.json b/package.json index 4b4b5de..03f6269 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,15 @@ "type": "git", "url": "git+https://github.com/codebox/moment-precise-range.git" }, - "tonicExampleFilename" : "example/example.js", + "tonicExampleFilename": "example/example.js", "author": "Rob Dawson (http://codebox.org.uk)", "license": "MIT", "bugs": { "url": "https://github.com/codebox/moment-precise-range/issues" }, - "homepage": "https://github.com/codebox/moment-precise-range#readme" + "homepage": "https://github.com/codebox/moment-precise-range#readme", + "devDependencies": { + "jasmine": "^2.5.0", + "moment": "^2.14.1" + } } diff --git a/test/tests/moment-precise-range-test.js b/test/tests/moment-precise-range-test.js index c3fe363..afd564a 100644 --- a/test/tests/moment-precise-range-test.js +++ b/test/tests/moment-precise-range-test.js @@ -1,4 +1,5 @@ if (typeof require !== "undefined") { + var moment = require('moment'); require('../../moment-precise-range'); } @@ -100,7 +101,7 @@ describe("preciseDiff", function() { it("start month has fewer days than last full month", function() { test('2013-04-29 00:00:00+0000', '2013-08-01 00:00:00+0000', '3 months 3 days'); test('2013-04-30 00:00:00+0000', '2013-08-01 00:00:00+0000', '3 months 2 days'); - // no way to get '3 months 1 day' to 2013-08-01 + // no way to get '3 months 1 day' to 2013-08-01 }); it("start month has same days as last full month", function() { test('2013-05-30 00:00:00+0000', '2013-08-01 00:00:00+0000', '2 months 2 days'); @@ -170,4 +171,4 @@ describe("preciseDiff", function() { }); -}); \ No newline at end of file +});