From f652542c57e5231b4782cd9e6f95df6be658f30a Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 20 Dec 2013 08:03:30 -0900 Subject: [PATCH] Removed UTC based calculation for diff() All the diff unit tests now run in local time. --- test/ringo/utils/dates_test.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/ringo/utils/dates_test.js b/test/ringo/utils/dates_test.js index 8e80e4c5d..2a92be4d6 100644 --- a/test/ringo/utils/dates_test.js +++ b/test/ringo/utils/dates_test.js @@ -324,17 +324,8 @@ exports.testDiff = function() { }); // 366 + 31 days = 397 days - a = new Date(Date.UTC(2012, 0, 1)); - b = new Date(Date.UTC(2013, 1, 1)); - - assert.equal(dates.diff(a, b, "year"), 1); - assert.equal(dates.diff(a, b, "quarter"), 4); - assert.equal(dates.diff(a, b, "month"), 13); - assert.equal(dates.diff(a, b, "week"), 56); - assert.equal(dates.diff(a, b, "day"), 397); - - // again Einstein, now with time diff - b = new Date(Date.UTC(2013, 1, 1, 20, 20, 20, 20)); + a = new Date(2012, 0, 1); + b = new Date(2013, 1, 1); assert.equal(dates.diff(a, b, "year"), 1); assert.equal(dates.diff(a, b, "quarter"), 4); assert.equal(dates.diff(a, b, "month"), 13); @@ -342,8 +333,8 @@ exports.testDiff = function() { assert.equal(dates.diff(a, b, "day"), 397); // no difference in quarters - a = new Date(2013, 11, 1); // Q4/2013 - b = new Date(2013, 9, 1); // Q4/2013 + a = new Date(2013, 11, 1, 12, 0, 0); // Q4/2013 + b = new Date(2013, 9, 1, 12, 0, 0); // Q4/2013 assert.equal(dates.diff(a, b, "year"), 0); assert.equal(dates.diff(b, a, "year"), 0); assert.equal(dates.diff(a, b, "quarter"), 0);