Skip to content

Commit

Permalink
[Tests] fix negative Date tests to handle TZData
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 9, 2020
1 parent e938fda commit a1098aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/spec/s-date.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ')'));
});
});
});
Expand Down

0 comments on commit a1098aa

Please sign in to comment.