Skip to content

Commit 2a005c5

Browse files
committed
Fix failing date tests
Previously we used an unlikely timezone: GMT+08h08m22s. This was used to test that converted dates were the same as one another. However, it seems that now, iOS ignores or rounds down the seconds when creating a timezone. That resulted in test failures where we compared the seconds to `0` – under iOS 26, the actual value was 22, equal to the number of seconds after the last whole minute in the timezone we used. I’ve made it an exact number of minutes to fix the test.
1 parent 601d49a commit 2a005c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/Tests/YosemiteTests/Model/Extensions/OrderStatsV4Interval+DateTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ final class OrderStatsV4Interval_DateTests: XCTestCase {
1111
dateEnd: dateStringInSiteTimeZone,
1212
subtotals: mockIntervalSubtotals)
1313
// As long as the dates are parsed and formatted in the same time zone, they should be consistent.
14-
let timeZone = TimeZone(secondsFromGMT: 29302)!
14+
// Note that iOS 26 has changed behaviour here, and excess seconds in the timezone break the calculation
15+
// This is 488 minutes, or 8 hours and 8 minutes
16+
let timeZone = TimeZone(secondsFromGMT: 29280)!
1517
[interval.dateStart(timeZone: timeZone), interval.dateEnd(timeZone: timeZone)].forEach { date in
1618
let dateComponents = Calendar(identifier: .iso8601).dateComponents(in: timeZone, from: date)
1719
XCTAssertEqual(dateComponents.year, 2019)

0 commit comments

Comments
 (0)