From: Matt Johnson Date: Sun, 13 Mar 2016 02:40:21 +0000 (-0800) Subject: Ignore these tests during DST X-Git-Tag: 2.13.0~37^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e5163ddf39844a077489af8e0de87eebca7957e;p=thirdparty%2Fmoment.git Ignore these tests during DST --- diff --git a/src/test/helpers/dst.js b/src/test/helpers/dst.js new file mode 100644 index 000000000..3bf09ee6c --- /dev/null +++ b/src/test/helpers/dst.js @@ -0,0 +1,5 @@ +import moment from '../../moment'; + +export function isNearSpringDST() { + return moment().subtract(1, 'day').utcOffset() !== moment().add(1, 'day').utcOffset(); +} diff --git a/src/test/moment/zone_switching.js b/src/test/moment/zone_switching.js index 7d8460640..d3d66e0f6 100644 --- a/src/test/moment/zone_switching.js +++ b/src/test/moment/zone_switching.js @@ -1,5 +1,6 @@ -import { module, test } from '../qunit'; +import { module, test, expect } from '../qunit'; import moment from '../../moment'; +import { isNearSpringDST } from '../helpers/dst'; module('zone switching'); @@ -45,6 +46,12 @@ test('local to zone, keepLocalTime = false', function (assert) { }); test('utc to local, keepLocalTime = true', function (assert) { + // Don't test near the spring DST transition + if (isNearSpringDST()) { + expect(0); + return; + } + var um = moment.utc(), fmt = 'YYYY-DD-MM HH:mm:ss'; @@ -58,6 +65,12 @@ test('utc to local, keepLocalTime = false', function (assert) { }); test('zone to local, keepLocalTime = true', function (assert) { + // Don't test near the spring DST transition + if (isNearSpringDST()) { + expect(0); + return; + } + var m = moment(), fmt = 'YYYY-DD-MM HH:mm:ss', z;