From 1e4b73b556f27746fcd116af03994db90c24d3fc Mon Sep 17 00:00:00 2001 From: Iskren Chernev Date: Mon, 2 Jun 2014 23:22:09 -0700 Subject: [PATCH] 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 --- test/moment/diff.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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"); -- 2.47.2