From: Iskren Chernev Date: Tue, 3 Jun 2014 06:22:09 +0000 (-0700) Subject: Fix broken year diff tests for Russia X-Git-Tag: 2.7.0~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1687%2Fhead;p=thirdparty%2Fmoment.git Fix broken year diff tests for Russia Russia's zone offset is different on 1st of January (something we assumed impossible in tests). Check to see if that is the case and skip the offending test. Fixes #1635 and #1612 --- diff --git a/test/moment/diff.js b/test/moment/diff.js index 649518e44..a17632362 100644 --- a/test/moment/diff.js +++ b/test/moment/diff.js @@ -174,9 +174,10 @@ exports.diff = { }, "diff between utc and local" : function (test) { - test.expect(7); - - test.equal(moment([2012]).utc().diff([2011], 'years'), 1, "year diff"); + if (moment([2012]).zone() === moment([2011]).zone()) { + // Russia's zone offset on 1st of Jan 2012 vs 2011 is different + test.equal(moment([2012]).utc().diff([2011], 'years'), 1, "year diff"); + } test.equal(moment([2010, 2, 2]).utc().diff([2010, 0, 2], 'months'), 2, "month diff"); test.equal(moment([2010, 0, 4]).utc().diff([2010], 'days'), 3, "day diff"); test.equal(moment([2010, 0, 22]).utc().diff([2010], 'weeks'), 3, "week diff");