         let newer = Date(timeIntervalSinceReferenceDate: 3600 * 24 * 60)
         
         // Minimization shouldn't do anything since this spans more than a month
-        XCTAssertEqual(formatter.string(from: older, to: newer),
-                       "Jan 1 – Mar 2")
+        let result = formatter.string(from: older, to: newer)
+        XCTAssert(result.containsInOrder(requiresLastToBeAtEnd: true, "Jan", "1", "Mar", "2"))
     }
     #endif
     
-    func testStringFromDateToDateAcrossFiveHours() {
+    func testStringFromDateToDateAcrossFiveHours() throws {
         do {
             let older = Date(timeIntervalSinceReferenceDate: 0)
             let newer = Date(timeIntervalSinceReferenceDate: 3600 * 5)
             
-            XCTAssertEqual(formatter.string(from: older, to: newer),
-                           "January 1, 2001, 12:00:00 AM GMT – 5:00:00 AM GMT")
+            let result = formatter.string(from: older, to: newer)
+            XCTAssert(result.containsInOrder(requiresLastToBeAtEnd: true, "January", "1", "2001", "12:00:00 AM", "5:00:00 AM"))
+            
+            let firstJanuary = try result.range(of: "January").unwrapped()
+            XCTAssertNil(result[firstJanuary.upperBound...].range(of: "January")) // January appears only once.
         }
         
         do {

            let older = Date(timeIntervalSinceReferenceDate: 0)
            let newer = Date(timeIntervalSinceReferenceDate: 3600 * 24 * 7)
            
            XCTAssertEqual(formatter.string(from: older, to: newer),
                           "Jan 1 – 8")
        }
        
        do {
            let older = Date(timeIntervalSinceReferenceDate: 3600 * 24 * 28)
            let newer = Date(timeIntervalSinceReferenceDate: 3600 * 24 * 34)
            
            XCTAssertEqual(formatter.string(from: older, to: newer),
                           "Jan 29 – Feb 4")
        }
    }
    

    #endif
#endif

extension String {
    func containsInOrder(requiresLastToBeAtEnd: Bool = false, _ substrings: String...) -> Bool {
        var foundRange: Range<String.Index> = startIndex ..< startIndex
        for substring in substrings {
            if let newRange = range(of: substring, options: [], range: foundRange.upperBound..<endIndex, locale: nil) {
                foundRange = newRange
            } else {
                return false
            }
        }
        
        if requiresLastToBeAtEnd {
            return foundRange.upperBound == endIndex
        } else {
            return true
        }
    }
}

class TestDateIntervalFormatter: XCTestCase {
    private var formatter: DateIntervalFormatter!
    
