From a1098aa77f45c7d15908df3520743a381d03513e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 9 Jan 2020 15:36:26 -0800 Subject: [PATCH] [Tests] fix negative Date tests to handle TZData --- tests/spec/s-date.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/spec/s-date.js b/tests/spec/s-date.js index 656f6fcc..92ec1211 100644 --- a/tests/spec/s-date.js +++ b/tests/spec/s-date.js @@ -465,8 +465,10 @@ describe('Date', function () { describe('#getSeconds()', function () { it('should return the right value for negative dates', function () { negativeDate.forEach(function (item) { - item.dates.forEach(function (date) { - expect(date.getSeconds()).toBe(59); + item.dates.forEach(function (date, i) { + // the regex here is because in UTC, it's 59, but with TZData applied, + // which can have fractional hour offsets, it'll be 1. + expect(i + ':' + date.getSeconds()).toMatch(new RegExp(i + ':(?:' + 59 + '|' + 1 + ')')); }); }); });